Skip to content

Instantly share code, notes, and snippets.

@vcabbage
Last active November 21, 2018 20:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vcabbage/6d4e56676ee9c840b6d0fb192b139999 to your computer and use it in GitHub Desktop.
Save vcabbage/6d4e56676ee9c840b6d0fb192b139999 to your computer and use it in GitHub Desktop.
Multi-stage Dockerfile
FROM golang:alpine AS build
ADD . /go/src/github.com/my/project
WORKDIR /go/src/github.com/my/project
RUN go build -o /mybinary ./cmd/mybinary
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=build /mybinary /mybinary
ENTRYPOINT ["/mybinary"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment