-
-
Save smallnest/80d59cdad1002c094c5434340abb38c7 to your computer and use it in GitHub Desktop.
Create a static binary in go and put it in a from scratch docker container
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.9 | |
RUN mkdir -p /go/src/github.com/purplebooth/example | |
WORKDIR /go/src/github.com/purplebooth/example | |
COPY . . | |
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go | |
FROM scratch | |
COPY --from=0 /go/src/github.com/purplebooth/example/main /main | |
CMD ["/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment