Skip to content

Build docker image for subsequent jobs #34

Build docker image for subsequent jobs

Build docker image for subsequent jobs #34

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-arm64:
name: Build (Docker arm64)
needs: [build-kernel]
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- image: jstz-rollup
dockerfile: ./crates/jstz_rollup/Dockerfile
steps:
- uses: jstz-dev/jstz/.github/actions/build-docker-image@huanchengchang-jstz-286
with:
platform: linux
arch: arm64
repo_token: ${{ secrets.GITHUB_TOKEN }}
octez-tag: ${{ inputs.octez-tag }}
docker_registry: ${{ env.DOCKER_REGISTRY }}
docker_registry_username: ${{ github.actor }}
docker_registry_password: ${{ secrets.GITHUB_TOKEN }}
docker_image_base: ${{ env.DOCKER_IMAGE_BASE }}
image: ${{ matrix.image }}
dockerfile: ${{ matrix.dockerfile }}
kernel_artefact_name: jstz-kernel
build-docker-amd64:
name: Build (Docker amd64)
needs: [build-kernel]
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- image: jstz-rollup
dockerfile: ./crates/jstz_rollup/Dockerfile
steps:
- uses: jstz-dev/jstz/.github/actions/build-docker-image@huanchengchang-jstz-286
with:
platform: linux
arch: amd64
repo_token: ${{ secrets.GITHUB_TOKEN }}
octez-tag: ${{ inputs.octez-tag }}
docker_registry: ${{ env.DOCKER_REGISTRY }}
docker_registry_username: ${{ github.actor }}
docker_registry_password: ${{ secrets.GITHUB_TOKEN }}
docker_image_base: ${{ env.DOCKER_IMAGE_BASE }}
image: ${{ matrix.image }}
dockerfile: ${{ matrix.dockerfile }}
kernel_artefact_name: jstz-kernel
merge:
runs-on: ubuntu-latest
needs:
- build-docker-amd64
- build-docker-arm64
strategy:
matrix:
include:
- image: jstz-rollup
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests/${{ matrix.image }}
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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}}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests/${{ matrix.image }}
run: |
docker buildx imagetools create -t ${{ fromJson(steps.meta.outputs.json).tags[0] }} \
$(printf '${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/${{ matrix.image }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ fromJson(steps.meta.outputs.json).tags[0] }}