Skip to content

Instantly share code, notes, and snippets.

@jrockway
Created February 26, 2019 18:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrockway/cceef8bb5dcef62743f8bcbc044cd2ad to your computer and use it in GitHub Desktop.
Save jrockway/cceef8bb5dcef62743f8bcbc044cd2ad to your computer and use it in GitHub Desktop.
Go image
FROM golang:alpine AS build
RUN apk add git bzr gcc musl-dev
WORKDIR /whatever/
COPY go.mod go.sum ./
ARG GOPROXY
RUN go mod download
COPY . .
ARG VERSION
RUN go install -ldflags "-X <internal package>.Version=$VERSION" -v ./your/app
FROM alpine:latest
RUN apk add ca-certificates tzdata
WORKDIR /
COPY --from=build /go/bin/app /go/bin/app
CMD ["/go/bin/app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment