Merge pull request #3 from insight-platform/2-implement-docker-image-… #2
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: main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
on: | |
push: | |
tags: [ 'v*.*.*' ] | |
branches: [ 'main' ] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
docker: | |
runs-on: | |
- self-hosted | |
- ${{ matrix.runner }} | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
matrix: | |
include: | |
- docker_file: Dockerfile | |
name: pipeline-watchdog-arm64 | |
arch: linux/arm64 | |
tag: ghcr.io/insight-platform/pipeline-watchdog-arm64 | |
runner: ARM64 | |
- docker_file: Dockerfile | |
name: pipeline-watchdog-x86 | |
arch: linux/amd64 | |
tag: ghcr.io/insight-platform/pipeline-watchdog-x86 | |
runner: X64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4.4.1 | |
# Set up BuildKit Docker container builder to be able to build | |
# multi-platform images and export cache | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.5.0 | |
# https://github.com/docker/build-push-action | |
- name: Build docker image for ${{ env.GITHUB_REF_SLUG }} | |
uses: docker/build-push-action@v6.5.0 | |
with: | |
file: ${{ matrix.docker_file }} | |
platforms: ${{ matrix.arch }} | |
tags: "${{matrix.tag}}:${{ env.GITHUB_REF_SLUG }}" | |
load: true | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
# https://github.com/docker/build-push-action | |
- name: Push docker image for ${{ env.GITHUB_REF_SLUG }} | |
uses: docker/build-push-action@v6.5.0 | |
with: | |
file: ${{ matrix.docker_file }} | |
platforms: ${{ matrix.arch }} | |
tags: "${{matrix.tag}}:${{ env.GITHUB_REF_SLUG }}" | |
push: true | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |