Build CLI images #14
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: Build CLI images | |
env: | |
GITHUB_OUTPUT: "" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Corresponds to git tag, e.g. "vX.Y.Z"' | |
required: true | |
jobs: | |
psinode-cli-builder: | |
name: psinode-cli-builder | |
strategy: | |
matrix: | |
runner: [ubuntu-latest, arm-runner-2] | |
include: | |
- runner: ubuntu-latest | |
platform: "linux/amd64" | |
platform_short: "amd64" | |
- runner: arm-runner-2 | |
platform: "linux/arm64" | |
platform_short: "arm64" | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
fetch-depth: 0 | |
- name: Building psinode-${{ matrix.platform_short }} | |
run: true | |
- name: Docker Buildx setup | |
uses: docker/setup-buildx-action@v3 | |
- name: Login in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set TOOL_CONFIG version | |
id: tool_cfg_img | |
run: | | |
latest_tag=$(./.github/scripts/latest-tag.sh "gofractally/http-tool-config") | |
echo "TOOL_CONFIG_IMAGE=ghcr.io/gofractally/http-tool-config:${latest_tag}" >> $GITHUB_OUTPUT | |
- name: Build & Publish Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
pull: true | |
file: docker/psinode.Dockerfile | |
no-cache: true | |
tags: "ghcr.io/${{ github.repository_owner }}/psinode:${{ github.event.inputs.version }}-${{matrix.platform_short}}" | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
build-args: | | |
RELEASE_TAG=${{ github.event.inputs.version }} | |
TOOL_CONFIG_IMAGE=${{ steps.tool_cfg_img.outputs.TOOL_CONFIG_IMAGE }} | |
psinode-cli-merger: | |
name: merge psinode multi-platform images | |
if: ${{ github.event_name != 'pull_request' }} | |
runs-on: ubuntu-latest | |
needs: psinode-cli-builder | |
steps: | |
- name: Config docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push manifest | |
run: | | |
IMAGE="ghcr.io/${{ github.repository_owner }}/psinode:${{ github.event.inputs.version }}" | |
docker manifest create ${IMAGE} \ | |
--amend ${IMAGE}-arm64 \ | |
--amend ${IMAGE}-amd64 | |
docker manifest push ${IMAGE} | |
psibase-cli-builder: | |
name: psibase-cli-builder | |
needs: psinode-cli-merger | |
strategy: | |
matrix: | |
runner: [ubuntu-latest, arm-runner-2] | |
include: | |
- runner: ubuntu-latest | |
platform: "linux/amd64" | |
platform_short: "amd64" | |
- runner: arm-runner-2 | |
platform: "linux/arm64" | |
platform_short: "arm64" | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
fetch-depth: 0 | |
- name: Building psibase-${{ matrix.platform_short }} | |
run: true | |
- name: Docker Buildx setup | |
uses: docker/setup-buildx-action@v3 | |
- name: Login in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & Publish Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
pull: true | |
file: docker/psibase.Dockerfile | |
no-cache: true | |
tags: "ghcr.io/${{ github.repository_owner }}/psibase:${{ github.event.inputs.version }}-${{matrix.platform_short}}" | |
platforms: ${{ matrix.platform }} | |
provenance: false | |
build-args: | | |
psinode_version=${{ github.event.inputs.version }} | |
psibase-cli-merger: | |
name: merge psibase multi-platform images | |
if: ${{ github.event_name != 'pull_request' }} | |
runs-on: ubuntu-latest | |
needs: psibase-cli-builder | |
steps: | |
- name: Config docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login in to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push manifest | |
run: | | |
IMAGE="ghcr.io/${{ github.repository_owner }}/psibase:${{ github.event.inputs.version }}" | |
docker manifest create ${IMAGE} \ | |
--amend ${IMAGE}-arm64 \ | |
--amend ${IMAGE}-amd64 | |
docker manifest push ${IMAGE} |