Last active
April 3, 2019 22:16
-
-
Save zombiezen/9f923cf8a8ca10c9af38068aa1d8f0a2 to your computer and use it in GitHub Desktop.
Go Modules Dockerfile
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
FROM golang:1.12 AS build | |
COPY go.mod go.sum m/ | |
RUN cd m && go mod download | |
COPY . srcroot | |
RUN cd srcroot && go install -mod=readonly ./cmd/foo \ | |
&& go clean -modcache -cache std | |
FROM debian:stretch-slim | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
&& rm -rf /var/lib/apt/lists/* | |
COPY --from=build /go/bin/foo /usr/bin/foo | |
ENTRYPOINT ["/usr/bin/foo"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment