Skip to content

Moving whitelist el code (#583) #25

Moving whitelist el code (#583)

Moving whitelist el code (#583) #25

name: "[Nethermind] Catalyst Node - Docker build and push"
on:
workflow_dispatch:
push:
branches: [master]
tags:
- "v*"
paths:
- "common/**"
- "permissionless/**"
- "whitelist/**"
- "tools/p2p_node/p2p_network/**"
env:
DOCKER_REGISTRY: docker.io
DOCKER_IMAGE_NAME: catalyst-node
DOCKER_REPOSITORY: nethermind
jobs:
build:
name: Build per-arch image
runs-on: ${{ matrix.os }}
if: github.repository == 'NethermindEth/Catalyst'
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux/amd64
short: amd64
- os: ubuntu-24.04-arm
platform: linux/arm64
short: arm64
outputs:
digest-amd64: ${{ steps.digest.outputs.amd64 }}
digest-arm64: ${{ steps.digest.outputs.arm64 }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
push: true
outputs: type=image,name=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }},push-by-digest=true,name-canonical=true
- name: Set digest output
id: digest
run: |
if [ "${{ matrix.short }}" = "amd64" ]; then
echo "amd64=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
fi
if [ "${{ matrix.short }}" = "arm64" ]; then
echo "arm64=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
fi
merge:
name: Merge and push multi-arch manifest
runs-on: ubuntu-latest
needs: build
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Determine event type and set tags
id: event
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "is_tag=true" >> $GITHUB_OUTPUT
echo "is_branch=false" >> $GITHUB_OUTPUT
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag_list=type=raw,value=$VERSION" >> $GITHUB_OUTPUT
else
echo "is_tag=false" >> $GITHUB_OUTPUT
echo "is_branch=true" >> $GITHUB_OUTPUT
echo "tag_list=type=raw,value=latest" >> $GITHUB_OUTPUT
fi
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}
tags: ${{ steps.event.outputs.tag_list }}
- name: Create manifest list and push
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
${{ needs.build.outputs.digest-amd64 }} \
${{ needs.build.outputs.digest-arm64 }}
- name: Summary
run: |
echo "## Docker build completed ✅" >> $GITHUB_STEP_SUMMARY
echo "### Tags" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r TAG; do
echo "- $TAG" >> $GITHUB_STEP_SUMMARY
done