Created
April 22, 2017 19:39
-
-
Save narqo/cadc3a676785647145fb7cf99f4ead7e to your computer and use it in GitHub Desktop.
Example of multi-stage build Dockerfile, introduced in docker v17.05.0
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
# Requires docker >= v17.05.0-ce-rc1 | |
# See http://blog.alexellis.io/mutli-stage-docker-builds/ | |
# Usage: | |
# > docker build -t syseng-exporter . | |
FROM golang:1.8 AS go-builder | |
WORKDIR /go/src/syseng_exporter | |
COPY *.go ./ | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o syseng_exporter . | |
FROM alpine:3.3 | |
RUN apk --no-cache add ca-certificates | |
COPY --from=go-builder /go/src/syseng_exporter/syseng_exporter / | |
CMD ["/syseng_exporter"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment