From 0080837e8801f6ccec712d9cbe646b0d7fdc9ef1 Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Thu, 18 Oct 2018 09:40:44 +0200 Subject: [PATCH] use multi-stage build to reduce image size --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d46d196..b2e5b9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.11-alpine +FROM golang:1.11-alpine AS build WORKDIR /go/src/app @@ -10,6 +10,10 @@ RUN dep ensure -vendor-only COPY . . -RUN go install -v +RUN go build -v -CMD ["app"] +FROM alpine +WORKDIR /app +COPY --from=build /go/src/app/app /app + +CMD [ "./app" ] \ No newline at end of file