From 7d7cfb7a5bb87b7ff96629c82b97d4c324beda4b Mon Sep 17 00:00:00 2001 From: Snider Date: Sat, 27 Sep 2025 23:10:43 +0100 Subject: [PATCH] Simplify Docker build workflow and update dependencies Refactored the GitHub Actions workflow to remove the build matrix and multi-arch manifest steps, consolidating the build into a single job targeting a specific build target. Updated the Dockerfile to add python-is-python3 and python3-dev to dependencies for improved Python compatibility. --- .github/workflows/build-docker.yml | 76 +++-------------------- utils/docker/images/lthn-chain/Dockerfile | 4 +- 2 files changed, 9 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 40a6c2a4..0a88fab3 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -1,7 +1,6 @@ name: Docker permissions: contents: read - packages: write on: workflow_call: secrets: @@ -18,25 +17,8 @@ on: jobs: build: - name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet-' || '' }}${{ matrix.arch_tag }}" + name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}" 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 @@ -44,71 +26,27 @@ jobs: 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: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build ${{ matrix.platform }} + - name: Build and push 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_TARGET=gcc-linux-x86_64 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 + diff --git a/utils/docker/images/lthn-chain/Dockerfile b/utils/docker/images/lthn-chain/Dockerfile index cd8b2ab1..f32c9603 100644 --- a/utils/docker/images/lthn-chain/Dockerfile +++ b/utils/docker/images/lthn-chain/Dockerfile @@ -23,8 +23,8 @@ RUN apt update && apt -y upgrade RUN apt install -y build-essential pkgconf \ curl ca-certificates bison autotools-dev checkinstall \ - g++ llvm clang lld cmake \ - git python3 python3-pip xz-utils gperf + g++ llvm clang lld cmake python-is-python3 \ + git python3 python3-pip python3-dev xz-utils gperf RUN pip3 install conan --break-system-packages