Skip to content

Instantly share code, notes, and snippets.

Last active Oct 2, 2017
What would you like to do?
Multi-stage builds example
# @see
FROM golang:1.9-alpine as builder
WORKDIR /go/src/
RUN apk --update add ca-certificates
# RUN go get -d -v
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM scratch
WORKDIR /root/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/src/ .
CMD ["./app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment