diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e4c0c4..462c220 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,12 +40,19 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.11.1 + with: + use: true + platforms: linux/arm64,linux/amd64 + - name: build and push uses: docker/build-push-action@v6 with: push: true build-args: | VERSION=${{ env.RELEASE_VERSION }} + platforms: linux/arm64,linux/amd64 tags: | ghcr.io/vladopajic/go-test-coverage:${{ env.RELEASE_VERSION }} ghcr.io/vladopajic/go-test-coverage:${{ steps.majorver.outputs.major-tag }} diff --git a/Dockerfile b/Dockerfile index 03cd777..f408142 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # GO_VERSION: automatically update to most recent via dependabot -FROM golang:1.25.3 AS builder +FROM --platform=$BUILDPLATFORM golang:1.25.3 AS builder + WORKDIR /workspace COPY go.mod go.mod @@ -10,10 +11,13 @@ RUN go mod download all COPY ./ ./ ARG VERSION -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ +ARG TARGETOS +ARG TARGETARCH + +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -o go-test-coverage . -FROM gcr.io/distroless/base:latest +FROM --platform=$BUILDPLATFORM gcr.io/distroless/base:latest WORKDIR / COPY --from=builder /workspace/go-test-coverage . COPY --from=builder /usr/local/go/bin/go /usr/local/go/bin/go