Created
January 7, 2021 00:37
-
-
Save pwillis-els/342193978b3c4ceb96813b5059773335 to your computer and use it in GitHub Desktop.
Dockerfile for building Go applications with multi-stage builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:alpine as build | |
RUN apk add -U --no-cache git | |
WORKDIR /build | |
COPY /core /build/core | |
COPY /vendor /build/vendor | |
COPY *.mod *.sum *.go /build/ | |
#RUN go mod download | |
RUN go build -o main . | |
FROM debian:buster-slim | |
COPY --from=build /build/main /main | |
ENTRYPOINT ["/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment