Created
April 24, 2019 17:51
-
-
Save kylejeske/7688e65981f914fb33a339a1bae65559 to your computer and use it in GitHub Desktop.
Example of GoLang min build in Multi-Stage Dockerfile
This file contains 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 base-build | |
RUN apk update && apk add --no-cache git | |
WORKDIR $GOPATH/src/mypackage/myapp/ | |
COPY . . | |
RUN go get -d -v | |
RUN go build -o /go/bin/hello | |
## using COPY | |
FROM scratch | |
## COPY --from=base-builder /go/bin/hello /go/bin/hello | |
## OR | |
COPY --from=$0 /go/bin/hello /go/bin/hello | |
ENTRYPOINT ["/go/bin/hello"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment