feat: update Dockerfile

This commit is contained in:
hanif salafi 2024-03-07 16:08:02 +07:00
parent 232dac57e6
commit f2e90ae1d6
1 changed files with 6 additions and 0 deletions

View File

@ -1,9 +1,15 @@
FROM golang:alpine as builder
WORKDIR /app
COPY go.* ./
RUN go get -v ./...
RUN go mod download
RUN go mod vendor
COPY . .
RUN apk update && apk add upx ca-certificates openssl && update-ca-certificates
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o /bin/api-binary ./main.go
RUN upx -9 /bin/api-binary