2024-03-05 14:02:06 +13:00
|
|
|
name: Container build
|
2021-08-05 07:08:25 +12:00
|
|
|
|
|
|
|
on:
|
2024-03-05 14:02:06 +13:00
|
|
|
workflow_run:
|
|
|
|
workflows: ["Release Build"]
|
|
|
|
types:
|
|
|
|
- completed
|
|
|
|
env:
|
|
|
|
REGISTRY_IMAGE: quay.io/redlib/redlib
|
2021-08-05 07:08:25 +12:00
|
|
|
|
|
|
|
jobs:
|
2024-03-05 14:02:06 +13:00
|
|
|
build:
|
2021-08-05 07:08:25 +12:00
|
|
|
runs-on: ubuntu-latest
|
2023-06-01 11:47:58 +12:00
|
|
|
strategy:
|
2024-03-05 14:02:06 +13:00
|
|
|
fail-fast: false
|
2023-06-01 11:47:58 +12:00
|
|
|
matrix:
|
2024-03-05 14:02:06 +13:00
|
|
|
include:
|
2024-09-18 06:42:09 +12:00
|
|
|
- { platform: linux/amd64, target: x86_64-unknown-linux-musl }
|
|
|
|
- { platform: linux/arm64, target: aarch64-unknown-linux-musl }
|
|
|
|
- { platform: linux/arm/v7, target: armv7-unknown-linux-musleabihf }
|
2021-08-05 07:08:25 +12:00
|
|
|
steps:
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Checkout
|
2024-03-05 14:02:06 +13:00
|
|
|
uses: actions/checkout@v4
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Docker meta
|
2024-03-05 14:02:06 +13:00
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
2021-08-05 07:08:25 +12:00
|
|
|
with:
|
2024-03-05 14:02:06 +13:00
|
|
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
|
|
tags: |
|
|
|
|
type=sha
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Set up QEMU
|
2024-03-05 14:02:06 +13:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Set up Docker Buildx
|
2024-03-05 14:02:06 +13:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Login to Quay.io Container Registry
|
2024-03-05 14:02:06 +13:00
|
|
|
uses: docker/login-action@v3
|
2021-08-05 07:08:25 +12:00
|
|
|
with:
|
2024-03-05 14:02:06 +13:00
|
|
|
registry: quay.io
|
|
|
|
username: ${{ secrets.QUAY_USERNAME }}
|
|
|
|
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Build and push
|
2024-03-05 14:02:06 +13:00
|
|
|
id: build
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: ${{ matrix.platform }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
|
|
file: Dockerfile
|
|
|
|
build-args: TARGET=${{ matrix.target }}
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Export digest
|
2024-03-05 14:02:06 +13:00
|
|
|
run: |
|
|
|
|
mkdir -p /tmp/digests
|
|
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
|
|
touch "/tmp/digests/${digest#sha256:}"
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Upload digest
|
2024-09-17 08:29:52 +12:00
|
|
|
uses: actions/upload-artifact@v4
|
2024-03-05 14:02:06 +13:00
|
|
|
with:
|
2024-09-17 08:36:24 +12:00
|
|
|
name: digests-${{ matrix.target }}
|
2024-03-05 14:02:06 +13:00
|
|
|
path: /tmp/digests/*
|
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 1
|
|
|
|
merge:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
steps:
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Download digests
|
2024-09-04 11:21:11 +12:00
|
|
|
uses: actions/download-artifact@v4.1.7
|
2024-03-05 14:02:06 +13:00
|
|
|
with:
|
|
|
|
path: /tmp/digests
|
2024-09-18 06:37:39 +12:00
|
|
|
pattern: digests-*
|
|
|
|
merge-multiple: true
|
2024-09-18 06:42:09 +12:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2024-03-05 14:02:06 +13:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Docker meta
|
2024-03-05 14:02:06 +13:00
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
|
|
tags: |
|
|
|
|
type=sha
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Login to Quay.io Container Registry
|
2023-12-27 13:01:45 +13:00
|
|
|
uses: docker/login-action@v3
|
2021-08-05 07:08:25 +12:00
|
|
|
with:
|
2023-12-27 12:25:52 +13:00
|
|
|
registry: quay.io
|
|
|
|
username: ${{ secrets.QUAY_USERNAME }}
|
|
|
|
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Create manifest list and push
|
2024-03-05 14:02:06 +13:00
|
|
|
working-directory: /tmp/digests
|
|
|
|
run: |
|
|
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
|
|
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
2023-06-01 11:47:58 +12:00
|
|
|
|
2024-09-18 06:42:09 +12:00
|
|
|
# - name: Push README to Quay.io
|
|
|
|
# uses: christian-korneck/update-container-description-action@v1
|
|
|
|
# env:
|
|
|
|
# DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }}
|
|
|
|
# with:
|
|
|
|
# destination_container_repo: quay.io/redlib/redlib
|
|
|
|
# provider: quay
|
|
|
|
# readme_file: 'README.md'
|
2023-06-01 11:47:58 +12:00
|
|
|
|
2024-09-18 06:42:09 +12:00
|
|
|
- name: Inspect image
|
2024-03-05 14:02:06 +13:00
|
|
|
run: |
|
|
|
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|