From 073b9836a4cb6063fcb123dabb0ff31796163d5f Mon Sep 17 00:00:00 2001 From: Jason N Date: Fri, 2 Feb 2024 10:43:20 +1100 Subject: [PATCH] Produce multi-arch images --- .github/workflows/docker-image.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 30bb42a..e4e7162 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,16 +16,29 @@ jobs: strategy: matrix: tag: ["alpine", "clang-tools", "cpp", "package", "qt", "snap", "docker-cli", "sphinx"] + include: + - tag: alpine + platforms: linux/amd64,linux/arm64 + - tag: cpp + platforms: linux/amd64,linux/arm64 permissions: contents: read packages: write steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + if: matrix.platforms != '' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + if: matrix.platforms != '' - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -33,14 +46,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=${{ matrix.tag }} - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . file: Dockerfile.${{ matrix.tag }} @@ -48,3 +61,4 @@ jobs: pull: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ matrix.platforms }}