diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f86390f..ee65f12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,9 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Docker meta id: meta uses: docker/metadata-action@v4 @@ -38,6 +41,7 @@ jobs: - name: Build and publish a docker image uses: docker/build-push-action@v4.0.0 with: + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 1d8768b..c2c77f1 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -24,13 +24,16 @@ jobs: - name: Build run: make build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Docker meta id: meta uses: docker/metadata-action@v4 with: # list of Docker images to use as base name for tags images: | - ghcr.io/skyscanner/kms-issuer + ghcr.io/${{ github.repository }} # generate Docker tags based on the following events/attributes tags: | type=ref,event=pr @@ -48,6 +51,7 @@ jobs: - name: Build and publish a docker image uses: docker/build-push-action@v4.0.0 with: + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index e564b06..e197d6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # Build the manager binary FROM golang:1.17 as builder +ARG TARGETARCH WORKDIR /workspace # Copy the Go Modules manifests @@ -16,7 +17,7 @@ COPY pkg/ pkg/ COPY controllers/ controllers/ # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details