en v26.2.1-20250213 (#117) #29
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: Docker Build and Push | |
on: | |
push: | |
branches: | |
- docker | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io/cronos-labs | |
IMAGE_NAME: external-node | |
IMAGE_TAG: v26.2.1-20250213 | |
BRANCH_NAME: cronos_core-v26.2.1-fix | |
jobs: | |
build-and-push: | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
runner: ubuntu-latest | |
platform: linux/amd64 | |
- arch: arm64 | |
runner: ubuntu-22.04-arm | |
platform: linux/arm64 | |
runs-on: ${{ matrix.runner }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Initial checkout for Dockerfile and scripts | |
uses: actions/checkout@v4 | |
- name: Save build files | |
run: | | |
mkdir -p /tmp/build-files | |
cp Dockerfile /tmp/build-files/ | |
- name: Checkout target branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
- name: Restore build files | |
run: | | |
cp /tmp/build-files/Dockerfile ./ | |
mkdir -p backups | |
cp docs/src/guides/external-node/docker-compose-examples/configs/generate_secrets.sh backups/generate_secrets.sh | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: ${{ matrix.platform }} | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-${{ matrix.arch }} | |
file: Dockerfile | |
build-args: | | |
BASE_IMAGE_TAG=${{ env.IMAGE_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
create-manifest: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push manifest | |
run: | | |
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-amd64 \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-arm64 |