Skip to content

Instantly share code, notes, and snippets.

@gregyjames
Created December 23, 2023 21:10
Show Gist options
  • Save gregyjames/b4835ccfe6f5a3f98b11cdfc9f89f23b to your computer and use it in GitHub Desktop.
Save gregyjames/b4835ccfe6f5a3f98b11cdfc9f89f23b to your computer and use it in GitHub Desktop.
Minimal size docker file for go
FROM golang:latest as golang
WORKDIR /app
COPY . .
RUN go mod download
RUN go mod verify
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server .
FROM gcr.io/distroless/static-debian11
COPY --from=golang /server .
EXPOSE 8080
CMD ["/server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment