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:
@@ -76,6 +76,7 @@ jobs:
|
||||
platforms: linux/${{ matrix.arch }}
|
||||
push: true
|
||||
provenance: false
|
||||
build-args: GOARCH=${{ matrix.arch }}
|
||||
tags: |
|
||||
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }}
|
||||
|
||||
|
||||
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