chore: slimmer docker base image & binary (#29)
Reduction of 352 MiB -> 8.22 MiB Reviewed-on: #29 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #29.
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,13 +1,14 @@
|
||||
FROM golang:1.23-alpine
|
||||
FROM golang:1.23-alpine as build
|
||||
|
||||
ARG GOARCH=amd64
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} \
|
||||
go build -trimpath -ldflags="-s -w" -o main .
|
||||
|
||||
RUN go build -o main .
|
||||
|
||||
CMD ["./main"]
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /app/main /
|
||||
CMD ["/main"]
|
||||
|
||||
Reference in New Issue
Block a user