From 30bbf47ea8876c09b81fff82fa7351fa1564571f Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Thu, 9 Mar 2023 16:03:34 -0500 Subject: [PATCH] feat: build a multi-arch image adding arm64 support --- .github/workflows/build-image.yaml | 39 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 8325c084..bdad3f13 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -24,25 +24,30 @@ jobs: id: add-latest-tag run: | echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV - - name: Build Image - id: build-image - uses: redhat-actions/buildah-build@v2 - with: - image: limitador - tags: ${{ env.IMG_TAGS }} - dockerfiles: | - ./Dockerfile - build-args: | - GITHUB_SHA=${{ github.sha }} - - name: Push Image - if: ${{ !env.ACT }} - id: push-to-quay - uses: redhat-actions/push-to-registry@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Quay.io + uses: redhat-actions/podman-login@v1 with: - image: ${{ steps.build-image.outputs.image }} - tags: ${{ steps.build-image.outputs.tags }} registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} username: ${{ secrets.IMG_REGISTRY_USERNAME }} password: ${{ secrets.IMG_REGISTRY_TOKEN }} + + - name: Build and Push Image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ env.IMG_TAGS }} + build-args: | + GITHUB_SHA=${{ github.sha }} + - name: Print Image URL - run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" + run: | + echo "Image pushed to: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ env.IMG_TAGS }}"