Skip to content

Instantly share code, notes, and snippets.

@cristaloleg
Created September 14, 2019 11:05
Show Gist options
  • Save cristaloleg/4ceeb3cecf2a64493242d4bbeb52627c to your computer and use it in GitHub Desktop.
Save cristaloleg/4ceeb3cecf2a64493242d4bbeb52627c to your computer and use it in GitHub Desktop.
# build stage
FROM golang:alpine AS builder
WORKDIR /go/src/github.com/foo/bar
COPY go.mod .
COPY go.sum .
RUN apk add --no-cache git
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -o front.exec cmd/main.go
# final stage
FROM scratch as prod
COPY --from=builder /go/src/github.com/foo/bar app.exec
LABEL Name=super-app Version=0.0.1
EXPOSE 8081
ENTRYPOINT ["./app.exec"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment