Last active
October 10, 2017 21:13
-
-
Save Philmod/59808b03b29193fc88497d6094b2a1b0 to your computer and use it in GitHub Desktop.
Builder pattern: one image to perform a build and another to have a lean runtime image, in a same 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
# First Stage | |
FROM golang:1.6-alpine | |
RUN mkdir /app | |
ADD . /app/ | |
WORKDIR /app | |
RUN go build -o main . | |
# Second Stage | |
FROM alpine | |
EXPOSE 8000 | |
CMD ["/app"] | |
# Copy from first stage | |
COPY --from=0 /app/main /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment