Supporting multi-arch Docker images #90
Workflow file for this run
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
# Copyright 2024 Dotanuki Labs | |
# SPDX-License-Identifier: MIT | |
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY_IMAGE: ghcr.io/${{ github.repository }} | |
jobs: | |
checks: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Project Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Lint Bash Scripts | |
uses: dotanuki-labs/github-actions/quality/bash@main | |
# - name: Run Component Tests | |
# run: ./component-tests.sh | |
build-docker-images: | |
needs: checks | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
runner: ["ubuntu22-amd64-medium", "ubuntu22-arm64-medium"] | |
steps: | |
- name: Project Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Prepare build environment | |
id: docker-env | |
run: ./docker-build-helper.sh prepare-environment | |
- name: Docker metadata | |
id: docker-metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- name: Set up docker-buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
- name: Log in to Github Container Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build container Image | |
id: build | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 | |
with: | |
push: true | |
provenance: false | |
platforms: linux/${{ steps.docker-env.outputs.platform }} | |
labels: ${{ steps.docker-metadata.outputs.labels }} | |
outputs: type=registry,push=true | |
tags: ${{ env.REGISTRY_IMAGE }}:${{ github.sha }}-${{ steps.docker-env.outputs.platform }} | |
merge-manifests: | |
runs-on: ubuntu-22.04 | |
needs: build-docker-images | |
steps: | |
- name: Project Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Log in to Github Container Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and push merged manifest | |
run: ./docker-build-helper.sh push-merged-manifest ${{ github.sha }} |