Skip to content

feat(docker/node): sovereign node utils #19

feat(docker/node): sovereign node utils

feat(docker/node): sovereign node utils #19

Workflow file for this run

name: Build 0KN Node Docker Image
on:
pull_request:
branches:
- main
push:
branches:
- main
paths-ignore:
- '**/*.md'
- 'docs/**'
- 'tests/**'
tags:
- "v*"
permissions:
contents: read
packages: write
jobs:
build-push-docker-image:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/node
IMAGE_TEST: zkn/node
steps:
- name: Checkout repository
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
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
# https://docs.docker.com/build/ci/github-actions/reproducible-builds/
- name: Set source build date from git commit timestamp
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Build and export to Docker
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
with:
file: ./docker/node/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.IMAGE_TEST }}:test
load: true
- name: Test docker image
run: docker run --rm ${{ env.IMAGE_TEST }}:test /bin/bash -c 'ls -l /opt/zkn/'
- name: Docker build and push
uses: docker/build-push-action@v6
with:
file: ./docker/node/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
- name: List docker images
run: docker images