Skip to content

Commit

Permalink
Allow GH Actions to build docker images using multi-stage
Browse files Browse the repository at this point in the history
Allow Github Actions to also build docker images using multi-stage.
Theoretically this can enable building images for linux/arm64 but
as of now there is no publicly available native GH runners for this
architecture.
  • Loading branch information
jsdanielh committed Jan 16, 2025
1 parent 2620218 commit e439b38
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions .github/workflows/github_release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,23 @@ 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
# As of now, linux/arm64 runners are Qemu based and public native ones will be
# available in Q1 2025. See https://github.com/github/roadmap/issues/970.
# - 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 +40,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: build
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
context: .
Expand All @@ -76,3 +56,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha
platforms: ${{ matrix.platform }}

0 comments on commit e439b38

Please sign in to comment.