Skip to content

Instantly share code, notes, and snippets.

@alexesDev
Created January 10, 2020 14:41
Show Gist options
  • Save alexesDev/54151a164d48e7062c8b62d8784715ce to your computer and use it in GitHub Desktop.
Save alexesDev/54151a164d48e7062c8b62d8784715ce to your computer and use it in GitHub Desktop.
Dockerfile for golang
FROM golang:1.13.4-alpine3.10 as build
RUN apk add --update git
WORKDIR /app
COPY go.mod go.sum /app/
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-w -extldflags "-static"' -o app .
FROM scratch
COPY --from=0 /app/app .
CMD ["./app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment