Created
January 11, 2019 20:46
-
-
Save maxfunke/e6f6586c61ddc29a38ec3d88c9e72e85 to your computer and use it in GitHub Desktop.
multistage dockerfile
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
# Multistage build | |
FROM golang:alpine as build | |
## stage1: build app, make use of /go/src | |
RUN mkdir /go/src/app | |
WORKDIR /go/src/app | |
ADD ./src/main.go /go/src/app | |
RUN go build -o /bin/app | |
## stage2: bin to plain image | |
FROM scratch | |
COPY --from=build /bin/app /bin/app | |
ENTRYPOINT ["/bin/app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment