Last active
May 14, 2022 21:31
-
-
Save JulienBreux/c463171d6fc91565705b4f791d88f137 to your computer and use it in GitHub Desktop.
Multi-stage builds example
This file contains 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
# @see https://github.com/JulienBreux/tuto-go-docker-ms | |
FROM golang:1.9-alpine as builder | |
WORKDIR /go/src/github.com/JulienBreux/tuto-go-docker-ms/ | |
RUN apk --update add ca-certificates | |
# 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 . | |
FROM scratch | |
ENV PATH=/bin | |
WORKDIR /root/ | |
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | |
COPY --from=builder /go/src/github.com/JulienBreux/tuto-go-docker-ms/app . | |
CMD ["./app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment