1
0
Fork 0
forked from lthn/blockchain

Add multi-arch Docker build and manifest to CI workflow

Refactors the build-docker GitHub Actions workflow to build and push Docker images for both amd64 and arm64 architectures using a matrix strategy. Adds a manifest job to create and push a multi-arch manifest for the lthn/chain image, supporting both 'testnet' and 'latest' tags based on input.
This commit is contained in:
Snider 2025-10-01 20:19:06 +01:00
parent 0089a308fd
commit 6987a33f83

View file

@ -14,39 +14,90 @@ on:
default: testnet
required: false
type: string
env:
LTHN_TAG: ${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
jobs:
build:
name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}"
runs-on: ubuntu-22.04
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
tag: ${{ env.LTHN_TAG }}-amd64
platform: linux/amd64
- arch: arm64
runner: ubuntu-arm
tag: ${{ env.LTHN_TAG }}-arm64
platform: linux/arm64
steps:
- name: Checkout Project
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
submodules: recursive
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: utils/docker/images/lthn-chain/Dockerfile
context: ${{ github.workspace }}
push: true
build-args: |
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
THREADS=2
BUILD_TARGET=gcc-linux-x86_64
BUILD_LOCAL=1
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
platforms: ${{ matrix.platform }}
tags: lthn/chain:${{ matrix.tag }}
manifest:
needs: build
runs-on: ubuntu-latest
steps:
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and push manifest
run: |
docker manifest create lthn/chain:${{ env.LTHN_TAG }} \
lthn/chain:${{ env.LTHN_TAG }}-amd64 \
lthn/chain:${{ env.LTHN_TAG }}-arm64
docker manifest push lthn/chain:${{ env.LTHN_TAG }}
# build:
# name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}"
# runs-on: ubuntu-24.04
# steps:
# - name: Checkout Project
# uses: actions/checkout@v4.2.2
# with:
# fetch-depth: 0
# submodules: recursive
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
#
# - name: Build and push
# id: docker_build
# uses: docker/build-push-action@v6
# with:
# file: utils/docker/images/lthn-chain/Dockerfile
# context: ${{ github.workspace }}
# push: true
# build-args: |
# BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
# THREADS=2
# BUILD_LOCAL=1
# tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
#