diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b8fb495..040bbd1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -69,7 +69,7 @@ jobs: uses: docker/build-push-action@v7 with: context: . - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: ${{ env.PUSH == 'true' }} tags: ${{ steps.v.outputs.tags }} labels: | diff --git a/Dockerfile b/Dockerfile index 27c87a8..84f475e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ # mock-llmd: one static Go binary on distroless. -FROM golang:1.27 AS build +# Multi-arch: Go cross-compiles, so the build stage runs on the builder's own +# platform and only the runtime stage is per-target -- no emulation needed. +FROM --platform=$BUILDPLATFORM golang:1.27 AS build +ARG TARGETOS TARGETARCH WORKDIR /src COPY go.mod go.sum ./ @@ -8,7 +11,7 @@ RUN go mod download # Only the sources: a locally built ./mock-llmd binary in the checkout stays out. COPY *.go ./ -RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/mock-llmd . +RUN CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -trimpath -ldflags="-s -w" -o /out/mock-llmd . FROM gcr.io/distroless/static-debian12:nonroot