From 0eeb7af7ebd564dbc0094782048e4d033dc739b4 Mon Sep 17 00:00:00 2001 From: Emmo00 Date: Mon, 22 Dec 2025 17:41:56 +0100 Subject: [PATCH 1/2] chore: enhance Docker build workflow with cache and disk space optimizations --- .github/workflows/build-images.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index de78d20..a8c81aa 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -24,6 +24,19 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + # Free up ~15-30 GB by removing unused pre-installed tools/packages + - name: Free disk space + uses: jlumbroso/free-disk-space@main # Reliable community action (or endersonmenezes/free-disk-space@v3) + with: + tool-cache: true + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + # Multi-platform setup - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: @@ -32,6 +45,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + # Login only on push - name: Log in to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 @@ -40,7 +54,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Build and push Prover image (energy-tracker) + # Prover image (energy-tracker) - name: Extract metadata for Prover image id: meta-prover uses: docker/metadata-action@v5 @@ -55,16 +69,18 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta-prover.outputs.tags }} labels: ${{ steps.meta-prover.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }}:buildcache,mode=max - name: Generate attestation for Prover image if: github.event_name != 'pull_request' uses: actions/attest-build-provenance@v3 with: subject-name: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }} - subject-digest: ${{ steps.build-and-push-prover.outputs.digest }} + subject-digest: ${{ steps.docker_build_prover.outputs.digest }} push-to-registry: true - # Build and push Streamr client image + # Streamr client image - name: Extract metadata for Streamr client image id: meta-streamr uses: docker/metadata-action@v5 @@ -79,11 +95,13 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta-streamr.outputs.tags }} labels: ${{ steps.meta-streamr.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }}:buildcache,mode=max - name: Generate attestation for Streamr client image if: github.event_name != 'pull_request' uses: actions/attest-build-provenance@v3 with: subject-name: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }} - subject-digest: ${{ steps.build-and-push-streamr.outputs.digest }} - push-to-registry: true + subject-digest: ${{ steps.docker_build_streamr.outputs.digest }} + push-to-registry: true \ No newline at end of file From 8f20f82a400b73ff79de6b29801efdd23f7ebb59 Mon Sep 17 00:00:00 2001 From: Emmo00 Date: Mon, 22 Dec 2025 18:00:43 +0100 Subject: [PATCH 2/2] chore: normalize Docker image names and streamline environment variable setup --- .github/workflows/build-images.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index a8c81aa..cadd17a 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -8,8 +8,6 @@ on: env: REGISTRY: ghcr.io - PROVER_IMAGE_NAME: ${{ github.repository }} - STREAMR_IMAGE_NAME: ${{ github.repository }}/streamr-client jobs: build-and-push-images: @@ -24,9 +22,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Normalize image names + run: | + echo "PROVER_IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + echo "STREAMR_IMAGE_NAME=${GITHUB_REPOSITORY,,}/streamr-client" >> $GITHUB_ENV + # Free up ~15-30 GB by removing unused pre-installed tools/packages - name: Free disk space - uses: jlumbroso/free-disk-space@main # Reliable community action (or endersonmenezes/free-disk-space@v3) + uses: jlumbroso/free-disk-space@main with: tool-cache: true android: true @@ -62,6 +65,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.PROVER_IMAGE_NAME }} - name: Build and push Prover image + id: docker_build_prover uses: docker/build-push-action@v6 with: context: . @@ -88,6 +92,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.STREAMR_IMAGE_NAME }} - name: Build and push Streamr client image + id: docker_build_streamr uses: docker/build-push-action@v6 with: context: ./streamr-client