Created
May 12, 2017 20:49
-
-
Save mishudark/9e3377ce1917db77a08b36bdbbeda21b to your computer and use it in GitHub Desktop.
Go multistage static linked
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:alpine | |
WORKDIR /go/src/github.com/mishudark/hello | |
RUN mkdir -p cmd/hello | |
COPY main.go cmd/hello/ | |
RUN CGO_ENABLED=0 GOOS=linux go install -ldflags "-s" -a -installsuffix cgo ./cmd/... | |
FROM alpine:latest | |
RUN apk --no-cache add ca-certificates | |
WORKDIR /root/ | |
COPY --from=0 /go/bin/hello . | |
RUN ./hello | |
CMD ["./hello"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment