Build + Release docker #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build + Release docker | |
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 | |
name: Build & publish docker image | |
needs: rust_build | |
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 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
flavor: latest=false | |
- name: Login to image repository | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
# This is required or a package with unknown architecture will be published too. | |
# See https://github.com/docker/build-push-action/issues/820 for further | |
# details. | |
# TODO - investigate further and see if we can find a solution where we | |
# don't have to set this. | |
provenance: false | |
tags: test | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha |