Skip to content

Instantly share code, notes, and snippets.

View freedombird9's full-sized avatar

Yongfeng Zhang freedombird9

View GitHub Profile
@freedombird9
freedombird9 / Dockerfile
Created June 5, 2019 03:25 — forked from PurpleBooth/Dockerfile
Create a static binary in go and put it in a from scratch docker container
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"]