Skip to content

Build docker image for subsequent jobs #38

Build docker image for subsequent jobs

Build docker image for subsequent jobs #38

Workflow file for this run

name: Build docker image for subsequent jobs
on:
push:
tags:
- "*"
# For manually rebuilding the images
workflow_dispatch:
inputs:
octez-tag:
description: "tezos/tezos docker tag to be used"
required: true
type: string
workflow_call:
inputs:
octez-tag:
description: "tezos/tezos docker tag to be used"
required: true
type: string
outputs:
jstz-cli:
description: "jstz docker image tag"
value: ${{ jobs.build-docker.outputs.jstz-cli }}
jstz-rollup:
description: "jstz-rollup docker image tag"
value: ${{ jobs.build-docker.outputs.jstz-rollup }}
jstz-node:
description: "jstz-node docker image tag"
value: ${{ jobs.build-docker.outputs.jstz-node }}
jstzd:
description: "jstzd docker image tag"
value: ${{ jobs.build-docker.outputs.jstzd }}
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_BASE: jstz-dev/jstz
jobs:
build-kernel:
name: Build (Kernel)
runs-on: [x86_64, linux, nix]
steps:
- uses: actions/checkout@v4
- run: nix --version
- name: Format
run: nix --accept-flake-config fmt -- --fail-on-change
- name: Prevent blst
run: nix --accept-flake-config develop -j auto --command sh -c '[ -z "$(cargo tree | grep blst)" ]'
- name: Build
run: nix --accept-flake-config --log-format raw -L build -j auto .#jstz_kernel
- name: Upload kernel
id: upload-kernel
uses: actions/upload-artifact@v4
with:
name: jstz-kernel
path: result/lib/jstz_kernel.wasm
build-docker:
name: Build (Docker)
needs: [build-kernel]
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
outputs:
jstz-cli: ${{ steps.jstz-cli-tag.outputs.tag || '' }}
jstz-rollup: ${{ steps.jstz-rollup-tag.outputs.tag || '' }}
jstz-node: ${{ steps.jstz-node-tag.outputs.tag || '' }}
jstzd: ${{ steps.jstzd-tag.outputs.tag || '' }}
strategy:
matrix:
include:
- image: jstzd
dockerfile: ./crates/jstzd/Dockerfile
platforms: linux/arm64
- image: jstz-cli
dockerfile: ./crates/jstz_cli/Dockerfile
platforms: linux/arm64
- image: jstz-node
dockerfile: ./crates/jstz_node/Dockerfile
platforms: linux/arm64
- image: jstz-rollup
dockerfile: ./crates/jstz_rollup/Dockerfile
platforms: linux/arm64
steps:
- 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: Login to Docker registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download jstz-kernel artifact
uses: actions/download-artifact@v4
with:
name: jstz-kernel
path: jstz_kernel
- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/${{ matrix.image }}
tags: |
type=ref,event=tag
{{sha}}
- # Extract tags for jstz
run: echo "tag=${{ fromJson(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT
id: jstz-cli-tag
if: matrix.image == 'jstz-cli'
- # Extract tags for jstz-node
run: echo "tag=${{ fromJson(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT
id: jstz-node-tag
if: matrix.image == 'jstz-node'
- # Extract tags for jstz-rollup
run: echo "tag=${{ fromJson(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT
id: jstz-rollup-tag
if: matrix.image == 'jstz-rollup'
- # Extract tags for jstzd
run: echo "tag=${{ fromJson(steps.meta.outputs.json).tags[0] }}" >> $GITHUB_OUTPUT
id: jstzd-tag
if: matrix.image == 'jstzd'
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
build-args: |
OCTEZ_TAG=${{ inputs.octez-tag }}
KERNEL_PATH=./jstz_kernel/jstz_kernel.wasm
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}