Skip to content

Test Docker images build #6

Test Docker images build

Test Docker images build #6

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
cardano_bin_url:
description: The url of the archive of the Cardano binaries
required: true
type: string
default: https://github.com/input-output-hk/cardano-node/releases/download/8.7.3/cardano-node-8.7.3-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@v3
- 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@v2
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@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
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@v3
with:
context: ${{ env.CONTEXT }}
file: ${{ env.DOCKER_FILE }}
build-args: CARDANO_BIN_URL=${{ inputs.cardano_bin_url }}
push: ${{ inputs.dry_run == false }}
tags: ${{ steps.meta.outputs.tags }}