Skip to content

Commit

Permalink
Allow GH Actions to build docker images for linux/arm64
Browse files Browse the repository at this point in the history
Allow Github Actions to also build docker images for linux/arm64 and
adapted workflow to be able to use the multi-stage Dockerfile.
  • Loading branch information
jsdanielh committed Jan 15, 2025
1 parent 032acd6 commit 9a5acea
Showing 1 changed file with 23 additions and 31 deletions.
54 changes: 23 additions & 31 deletions .github/workflows/github_release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -61,6 +38,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: build
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
context: .
Expand All @@ -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

0 comments on commit 9a5acea

Please sign in to comment.