From c52a7618571a76826c188059b0d038e14ef7c90e Mon Sep 17 00:00:00 2001 From: Reza Rajan <28660160+rezarajan@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:47:17 -0400 Subject: [PATCH 1/4] fix(ci-docker): switch to GitHub Actions cache to prevent runner disk exhaustion - refactor to use a matrix strategy for both amd64 and arm64 - remove qemu (https://github.com/blinklabs-io/docker-cardano-node/issues/300) Signed-off-by: Reza Rajan <28660160+rezarajan@users.noreply.github.com> --- .github/workflows/ci-docker.yml | 80 ++++++++------------------------- 1 file changed, 19 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 0380773..186b6b2 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -13,76 +13,34 @@ permissions: contents: read jobs: - build-amd64: - runs-on: ubuntu-latest + build: + strategy: + matrix: + arch: [amd64, arm64] + runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0 - - name: qemu - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 https://github.com/docker/setup-qemu-action/releases/tag/v3.7.0 - - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 https://github.com/docker/setup-buildx-action/releases/tag/v3.11.1 - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-buildx- - - id: meta - uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0 https://github.com/docker/metadata-action/releases/tag/v5.9.0 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=false - suffix=-amd64 - - name: build - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 https://github.com/docker/build-push-action/releases/tag/v6.18.0 - with: - context: . - push: false - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - # TEMP fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + - uses: actions/checkout@v5 + + - name: Setup QEMU (for cross-building, optional for amd64) + uses: docker/setup-qemu-action@v3 + if: matrix.arch == 'arm64' + + - uses: docker/setup-buildx-action@v3 - build-arm64: - runs-on: ubuntu-24.04-arm - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0 - - name: qemu - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 https://github.com/docker/setup-qemu-action/releases/tag/v3.7.0 - - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 https://github.com/docker/setup-buildx-action/releases/tag/v3.11.1 - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-buildx- - id: meta - uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0 https://github.com/docker/metadata-action/releases/tag/v5.9.0 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | latest=false - suffix=-arm64v8 - - name: build - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 https://github.com/docker/build-push-action/releases/tag/v6.18.0 + suffix=-${{ matrix.arch == 'arm64' && 'arm64v8' || 'amd64' }} + + - name: Build Docker image + uses: docker/build-push-action@v6 with: context: . push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - # TEMP fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + cache-from: type=gha + cache-to: type=gha,mode=max From 9f6508b72a7f684c49411f42bee8f895273e7490 Mon Sep 17 00:00:00 2001 From: Reza Rajan <28660160+rezarajan@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:56:05 -0400 Subject: [PATCH 2/4] refactor(ci-workflow): remove QEMU for native architecture builds Signed-off-by: Reza Rajan <28660160+rezarajan@users.noreply.github.com> --- .github/workflows/ci-docker.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 186b6b2..6bc2f3c 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -21,10 +21,6 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Setup QEMU (for cross-building, optional for amd64) - uses: docker/setup-qemu-action@v3 - if: matrix.arch == 'arm64' - - uses: docker/setup-buildx-action@v3 - id: meta From ddcb26270a0bf4deeea39e2e34e19e4b6c7fed7d Mon Sep 17 00:00:00 2001 From: Reza Rajan <28660160+rezarajan@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:36:29 -0400 Subject: [PATCH 3/4] fix(ci-docker): pin all actions to specific commit hashes Signed-off-by: Reza Rajan <28660160+rezarajan@users.noreply.github.com> --- .github/workflows/ci-docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 6bc2f3c..7052192 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -19,12 +19,12 @@ jobs: arch: [amd64, arm64] runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0 - - uses: docker/setup-buildx-action@v3 + - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 https://github.com/docker/setup-buildx-action/releases/tag/v3.11.1 - id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0 https://github.com/docker/metadata-action/releases/tag/v5.9.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | @@ -32,7 +32,7 @@ jobs: suffix=-${{ matrix.arch == 'arm64' && 'arm64v8' || 'amd64' }} - name: Build Docker image - uses: docker/build-push-action@v6 + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 https://github.com/docker/build-push-action/releases/tag/v6.18.0 with: context: . push: false From f5f2ac0887c95b7d3585e48cf5b16625754d429a Mon Sep 17 00:00:00 2001 From: Reza Rajan <28660160+rezarajan@users.noreply.github.com> Date: Fri, 21 Nov 2025 16:38:53 -0400 Subject: [PATCH 4/4] feat(ci-docker): use scoped cache names to avoid overwrites Signed-off-by: Reza Rajan <28660160+rezarajan@users.noreply.github.com> --- .github/workflows/ci-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 2438710..ea41c19 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -39,5 +39,5 @@ jobs: push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=buildkit-${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=buildkit-${{ matrix.arch }}