forked from lthn/blockchain
Introduces the docker/setup-qemu-action step in the GitHub Actions workflow to support multi-architecture builds. Also updates the lthn-chain Dockerfile to include autotools-dev and checkinstall in the build dependencies.
114 lines
3.4 KiB
YAML
114 lines
3.4 KiB
YAML
name: Docker
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
DOCKERHUB_USERNAME:
|
|
required: true
|
|
DOCKERHUB_TOKEN:
|
|
required: true
|
|
inputs:
|
|
chain-network:
|
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
|
default: testnet
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet-' || '' }}${{ matrix.arch_tag }}"
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
platform: [ linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le, linux/riscv64, linux/s390x ]
|
|
include:
|
|
- platform: linux/amd64
|
|
arch_tag: amd64
|
|
- platform: linux/arm64
|
|
arch_tag: arm64
|
|
- platform: linux/arm/v7
|
|
arch_tag: armv7
|
|
- platform: linux/ppc64le
|
|
arch_tag: ppc64le
|
|
- platform: linux/riscv64
|
|
arch_tag: riscv64
|
|
- platform: linux/s390x
|
|
arch_tag: s390x
|
|
|
|
steps:
|
|
- name: Checkout Project
|
|
uses: actions/checkout@v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build ${{ matrix.platform }}
|
|
id: docker_build
|
|
continue-on-error: true
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: utils/docker/images/lthn-chain/Dockerfile
|
|
context: ${{ github.workspace }}
|
|
platforms: ${{ matrix.platform }}
|
|
push: true
|
|
build-args: |
|
|
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
|
THREADS=2
|
|
BUILD_LOCAL=1
|
|
USE_CUSTOM_PROFILE=0
|
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet-' || '' }}${{ matrix.arch_tag }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
finalize_manifest:
|
|
needs: build
|
|
name: Multi-Arch Image
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build
|
|
id: docker_final
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: utils/docker/images/lthn-chain/Dockerfile
|
|
context: ${{ github.workspace }}
|
|
platforms: "linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le, linux/riscv64, linux/s390x"
|
|
push: true
|
|
build-args: |
|
|
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
|
THREADS=2
|
|
BUILD_LOCAL=1
|
|
USE_CUSTOM_PROFILE=0
|
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|