From 9a5acea3d526635c5b174b8b6edab00aab4edf7f Mon Sep 17 00:00:00 2001 From: Jose Daniel Hernandez Date: Wed, 15 Jan 2025 13:36:36 -0600 Subject: [PATCH] Allow GH Actions to build docker images for linux/arm64 Allow Github Actions to also build docker images for linux/arm64 and adapted workflow to be able to use the multi-stage Dockerfile. --- .github/workflows/github_release_docker.yml | 54 +++++++++------------ 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/.github/workflows/github_release_docker.yml b/.github/workflows/github_release_docker.yml index ebc9a6d5b1..47052fea9c 100644 --- a/.github/workflows/github_release_docker.yml +++ b/.github/workflows/github_release_docker.yml @@ -7,44 +7,21 @@ on: workflow_dispatch: jobs: - rust_build: - name: Build Nimiq with release flag - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - name: Build binaries in release mode - run: | - cargo build --release - - name: Archive production artifacts - uses: actions/upload-artifact@v4 - with: - name: nimiq-dist - path: | - target/release/nimiq-client - target/release/nimiq-bls - target/release/nimiq-address - target/release/nimiq-rpc - build_docker: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 name: Build & publish docker image - needs: rust_build + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + steps: - name: Check out the repo uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Download nimiq client artifact from previous job - uses: actions/download-artifact@v4 - with: - name: nimiq-dist - path: target/release/ - - - name: Run some commands - run: | - ls target/release/ -al - chmod -R +x target/release/ - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -61,6 +38,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push + id: build uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 with: context: . @@ -76,3 +54,17 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha + platforms: ${{ matrix.platform }} + + - name: Export digest + run: | + mkdir -p ${{ runner.temp }}/digests + digest="${{ steps.build.outputs.digest }}" + touch "${{ runner.temp }}/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_PAIR }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error