Skip to content

fix(CI): Unified mulitplatform namespace && dev container support #27

fix(CI): Unified mulitplatform namespace && dev container support

fix(CI): Unified mulitplatform namespace && dev container support #27

Workflow file for this run

name: Build and Publish Docker Image
on:
workflow_dispatch:
pull_request: ## testing only
push:
branches:
- eigenda
tags:
- "v[0-9]+.[0-9]+.[0-9]+-*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
runs-on: ${{ matrix.platform == 'linux/amd64' && 'linux-2xl' || 'linux-xl-arm' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Repo
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build nitro-node image
uses: ./.github/actions/docker-image
with:
context: .
file: Dockerfile
images: ghcr.io/layr-labs/nitro/nitro-node
target: nitro-node
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
- name: Build nitro-node-dev image
uses: ./.github/actions/docker-image
id: nitro-node-dev
with:
context: .
file: Dockerfile
images: ghcr.io/layr-labs/nitro/nitro-node-dev
target: nitro-node-dev
platforms: ${{ matrix.platform }}
push: ${{ github.event_name != 'pull_request' }}
merge_into_multiplatform_images:
needs:
- build
strategy:
matrix:
target: [nitro-node, nitro-node-dev]
include:
- target: nitro-node
image: ghcr.io/layr-labs/nitro/nitro-node
- target: nitro-node-dev
image: ghcr.io/layr-labs/nitro/nitro-node-dev
runs-on: linux-2xl
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Repo
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download digest amd64
uses: actions/download-artifact@v4
with:
name: "${{ matrix.target }}-digests-${{ github.run_number }}-amd64"
path: "${{ runner.temp }}/${{ matrix.target }}-${{ github.run_number }}-digests"
- name: Download digest arm64
uses: actions/download-artifact@v4
with:
name: "${{ matrix.target }}-digests-${{ github.run_number }}-arm64"
path: "${{ runner.temp }}/${{ matrix.target }}-${{ github.run_number }}-digests"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
- name: Create manifest list and push
working-directory: "${{ runner.temp }}/${{ matrix.target }}-${{ github.run_number }}-digests"
run: |
# Count the number of files in the directory
file_count=$(find . -type f | wc -l)
if [ "$file_count" -ne 2 ]; then
echo "Should have exactly 2 digests to combine, something went wrong"
ls -lah
exit 1
fi
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ matrix.image }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ matrix.image }}:${{ steps.meta.outputs.version }}