chore: slimmer docker base image & binary #29

Merged
t.behrendt merged 2 commits from chore-slimmer-docker-base-image into main 2025-02-16 20:27:30 +01:00
2 changed files with 9 additions and 7 deletions

View File

@@ -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 }}

View File

@@ -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"]