-
-
Save anjilinux/75aa8be72a0e60385239f01b220051cf to your computer and use it in GitHub Desktop.
Example multi stage docker file for go builds
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
| FROM golang:1.11.2 as build-image | |
| WORKDIR /go/src | |
| RUN go get -d -v golang.org/x/net/html | |
| COPY app.go . | |
| RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app app.go | |
| FROM alpine:latest | |
| RUN apk --no-cache add ca-certificates | |
| WORKDIR /root/ | |
| COPY --from=build-image /go/src/app . | |
| CMD ["./app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment