optimize go build options
All checks were successful
CI / test (pull_request) Successful in 5m23s

This commit is contained in:
2025-02-16 20:01:31 +01:00
parent 9a00172b09
commit e56df3a4da
2 changed files with 6 additions and 1 deletions

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 /