Skip to content

Instantly share code, notes, and snippets.

@antklim
Last active November 20, 2020 00:42
Show Gist options
  • Select an option

  • Save antklim/e36f229709862508bd7734f4ebb5a91b to your computer and use it in GitHub Desktop.

Select an option

Save antklim/e36f229709862508bd7734f4ebb5a91b to your computer and use it in GitHub Desktop.
# 1. Build
FROM golang:alpine as builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o . ./...
WORKDIR /dist
RUN cp /build/calc .
# 2. Run
FROM gcr.io/distroless/base
COPY --from=builder /dist/calc /
# Command to run
ENTRYPOINT ["/calc"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment