From 873d881a57e05803393bfcbf6c2cbec233ee23aa Mon Sep 17 00:00:00 2001 From: pablomendezroyo Date: Tue, 29 Jul 2025 11:10:56 +0200 Subject: [PATCH] add arm support --- .github/workflows/release.yml | 2 +- Dockerfile | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49b6139..a9a0179 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build and push Docker image (multi-arch) uses: docker/build-push-action@v3 with: file: Dockerfile diff --git a/Dockerfile b/Dockerfile index 967d1cc..48509ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -FROM golang:1.24-alpine AS builder +FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder +ARG TARGETOS +ARG TARGETARCH WORKDIR /app # Install git for Go modules @@ -12,8 +14,8 @@ RUN go mod download # Copy the entire codebase COPY . . -# Build the binary -RUN go build -o validator-tracker ./cmd/main.go +# Build a static binary for the target platform +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o validator-tracker ./cmd/main.go # Final image FROM alpine:3.21