Skip to content

Test Docker images build #40

Test Docker images build

Test Docker images build #40

name: Test Docker images build
on:
workflow_dispatch:
inputs:
distribution_code:
description: |
Specific code to identify the new distribution. The distribution package will be named with the following nomenclature: `test-{{distribution_code}}-{{sha}}`
required: true
type: string
commit_sha:
description: |
SHA of the commit on which the mithril binaries should be obtained, a "ci.yml" workflow must have run
on it otherwise no binary would be available leading to the failure of this workflow.
required: true
type: string
embed_cardano_cli:
description: |
Embed Cardano-cli in the Docker image.
Only needed if you want to use cardano-cli chain observer.
required: true
type: boolean
default: false
cardano_bin_url:
description: The url of the archive of the Cardano binaries
required: true
type: string
default: https://github.com/IntersectMBO/cardano-node/releases/download/9.0.0/cardano-node-9.0.0-linux.tar.gz
dry_run:
description: Dry run will not push the Docker images to the registry
required: true
type: boolean
default: true
jobs:
build-push-docker:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
project:
[
mithril-aggregator,
mithril-client-cli,
mithril-signer,
mithril-relay,
]
include:
- project: mithril-client-cli
package: mithril-client
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
PACKAGE: ${{ github.repository_owner }}/${{ matrix.package != '' && matrix.package || matrix.project }}
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
CONTEXT: .
GITHUB_REF: ${{ github.ref}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get short SHA
id: slug
run: echo "sha8=$(echo ${{ inputs.commit_sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Checkout commit
run: |
git checkout ${{ inputs.commit_sha }}
- name: Download built artifacts (Linux-x64)
uses: dawidd6/action-download-artifact@v3
with:
name: mithril-distribution-Linux-X64
path: ${{ matrix.project }}
commit: ${{ inputs.commit_sha }}
workflow: ci.yml
workflow_conclusion: completed
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.PACKAGE }}
tags: |
test
type=raw,value=test-${{ inputs.distribution_code }}-${{ steps.slug.outputs.sha8 }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ env.CONTEXT }}
file: ${{ env.DOCKER_FILE }}
build-args: |
EMBED-CARDANO-CLI=${{ inputs.embed_cardano_cli && 1 || 0 }}
CARDANO_BIN_URL=${{ inputs.cardano_bin_url }}
push: ${{ inputs.dry_run == false }}
tags: ${{ steps.meta.outputs.tags }}