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 6 additions and 1 deletions
Showing only changes of commit e56df3a4da - Show all commits

View File

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

View File

@@ -1,9 +1,13 @@
FROM golang:1.23-alpine as build FROM golang:1.23-alpine as build
ARG GOARCH=amd64
WORKDIR /app WORKDIR /app
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
RUN go build -o main . RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} \
go build -trimpath -ldflags="-s -w" -o main .
FROM gcr.io/distroless/static-debian12 FROM gcr.io/distroless/static-debian12
COPY --from=build /app/main / COPY --from=build /app/main /