1
0
Fork 0
forked from lthn/blockchain
blockchain/.github/workflows/build-docker.yml
Snider 973baa12c0 Update CI workflows and Makefile for improved builds
Refactors the Docker build workflow to use a matrix for multi-arch builds, updates build arguments, and improves Docker image tagging. Disables Conan package caching on Linux ARM64 and macOS Intel workflows. Changes the Windows build to use the 'msvc-194-x86_64' target and updates artifact paths accordingly. Enhances the Makefile to pass additional CMake variables and run cpack after building.
2025-10-02 00:08:44 +01:00

116 lines
3.3 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
env:
LTHN_TAG: ${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
tag: "-amd64"
platform: linux/amd64
- arch: arm64
runner: ubuntu-24.04-arm
tag: "-arm64"
platform: linux/arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
with:
context: ${{ github.workspace }}
file: utils/docker/images/lthn-chain/Dockerfile
push: true
target: chain-service
build-args: |
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
THREADS=2
BUILD_LOCAL=1
platforms: ${{ matrix.platform }}
tags: lthn/chain:${{ env.LTHN_TAG }}${{ matrix.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
# 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' }}
#