Build Docker Images #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker Images | |
# Add permissions configuration | |
permissions: | |
contents: read | |
packages: write | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag for the Docker images' | |
required: true | |
type: string | |
validator_branch: | |
description: 'Validator branch to use' | |
required: true | |
default: 'itn4-1.16.3' | |
type: string | |
cli_branch: | |
description: 'CLI branch to use' | |
required: true | |
default: 'itn4' | |
type: string | |
gui_branch: | |
description: 'GUI branch to use' | |
required: true | |
default: 'itn4' | |
type: string | |
jobs: | |
build: | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
include: | |
- arch: amd64 | |
runner: ubuntu-latest | |
- arch: arm64 | |
runner: arm-utils | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/shardeum/shardeum-validator-${{ matrix.arch }}:${{ inputs.tag }} | |
build-args: | | |
VALIDATOR_BRANCH=${{ inputs.validator_branch }} | |
CLI_BRANCH=${{ inputs.cli_branch }} | |
GUI_BRANCH=${{ inputs.gui_branch }} | |
create-manifest: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push manifest | |
run: | | |
docker manifest create ghcr.io/shardeum/shardeum-validator:${{ inputs.tag }} \ | |
ghcr.io/shardeum/shardeum-validator-amd64:${{ inputs.tag }} \ | |
ghcr.io/shardeum/shardeum-validator-arm64:${{ inputs.tag }} | |
docker manifest push ghcr.io/shardeum/shardeum-validator:${{ inputs.tag }} |