forked from lthn/blockchain
Adds build arguments to the Docker build workflow for testnet, threads, build target, and local build. Updates the Dockerfile to use the 'dev' branch by default and improves the testnet symlink creation logic to use sed for string replacement.
52 lines
1.4 KiB
YAML
52 lines
1.4 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-22.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_TARGET=gcc-linux-x86_64
|
|
BUILD_LOCAL=1
|
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
|
|