From 52a6881a153748ad55ded2f34a2bd090e44a5954 Mon Sep 17 00:00:00 2001 From: Robert O'Connor Date: Sun, 3 May 2020 01:42:25 -0400 Subject: [PATCH] Refactor the Dockerfile as a multistage build --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ece191..58fb3b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,15 @@ -FROM golang - -WORKDIR /go/src/github.com/HarukaNetwork/HarukaX +FROM golang:1.14-alpine as build +LABEL maintainer="" +ENV GO111MODULE=on +WORKDIR /harukax COPY . . -ENTRYPOINT ["go", "run", "."] +RUN CGO_ENABLED=0 GOOS=linux go build -o /build/harukax + +FROM alpine:3.9 + +COPY --from=build /build/harukax /harukax +RUN touch .env # godotenv is weird and needs this + +ENTRYPOINT ["/harukax"]