Created
January 10, 2020 14:41
-
-
Save alexesDev/54151a164d48e7062c8b62d8784715ce to your computer and use it in GitHub Desktop.
Dockerfile for golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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