forked from lthn/blockchain
Streamlines Docker build workflow by introducing a builder target and registry-based build cache in GitHub Actions. Refactors the Makefile to improve static/dynamic build flag handling, adds MSVC support, and separates configure/build steps. Updates Dockerfile to use new Makefile targets, simplifies build context handling, and fixes artifact copying. Removes redundant Docker build targets from the Makefile and enhances Conan MSVC runtime configuration.
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
name: Docker
|
|
permissions:
|
|
contents: read
|
|
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' || 'latest' }}"
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout Project
|
|
uses: actions/checkout@v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- 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
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
target: builder
|
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
|
cache-from: type=registry,ref=lthn/chain:buildcache
|
|
cache-to: type=registry,ref=lthn/chain:buildcache,mode=max
|
|
|
|
- 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
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
|
BUILD_THREADS=2
|
|
BUILD_LOCAL=1
|
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
|
cache-from: type=registry,ref=lthn/chain:buildcache
|
|
|