Created
July 22, 2021 22:53
-
-
Save mehmetcantas/5e4133b8a51587bdf0b9b1db7704fb3e to your computer and use it in GitHub Desktop.
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.16-alpine as builder | |
ARG CGO_ENABLED=0 | |
RUN apk add --no-cache upx | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . . | |
RUN go build -ldflags "-s -w" -o main ./cmd/api | |
RUN upx --best --lzma main | |
FROM scratch | |
COPY --from=builder /app/main . | |
ENTRYPOINT ["./main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment