Skip to content

Instantly share code, notes, and snippets.

@adelowo
Last active October 16, 2018 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adelowo/9d3dded0b548b715bc4386c4829b339f to your computer and use it in GitHub Desktop.
Save adelowo/9d3dded0b548b715bc4386c4829b339f to your computer and use it in GitHub Desktop.
Golang with module support and an extremely tiny Docker image that wouldn't stress you as "Scratch" would
docker build -t oops .
docker run oops
FROM golang:1.11 as build-env
WORKDIR /go/src/github.com/adelowo/project-with-go-mod
ADD . /go/src/github.com/adelowo/project-with-go-mod
ENV GO111MODULE=on
RUN go mod download
RUN go mod verify
RUN go install ./cmd
FROM gcr.io/distroless/base
COPY --from=build-env /go/bin/cmd /
CMD ["/cmd"]
@adelowo
Copy link
Author

adelowo commented Oct 15, 2018

This assumes, your package main is in ./cmd...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment