Skip to content

Instantly share code, notes, and snippets.

@pwillis-els
Created January 7, 2021 00:37
Show Gist options
  • Save pwillis-els/342193978b3c4ceb96813b5059773335 to your computer and use it in GitHub Desktop.
Save pwillis-els/342193978b3c4ceb96813b5059773335 to your computer and use it in GitHub Desktop.
Dockerfile for building Go applications with multi-stage builds
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