Skip to content

Merge images

Merge images #38

Workflow file for this run

name: Merge images
on:
workflow_run: # Fires when any of the specified workflows complete
workflows: ["Build and Publish Linux ARM64 Image", "Build and Publish Linux AMD64 Image"]
types: [completed]
env:
IMAGE: ${{ vars.DOCKERHUB_IMAGE }}
REGISTRY: docker.io
concurrency: # ensure only one merge runs at a time
group: merge-manifest
cancel-in-progress: false
jobs:
merge:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == vars.NIGHTLY_BRANCH }}
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
with: # these are defined in the GitHub Secrets UI
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Merge the multiple architecture-specific images into a single multi-arch image.
# If images for other architectures do not exist in the registry yet, this step will fail.
# It will only succeed when at least one image for each architecture has been built and pushed.
# If images for other architectures are being built and the ones in the registry
# are old, it only updates the nightly tag for the architecture that triggered this
# workflow. When images for other architectures are built successfully later, they will
# trigger this workflow again and merge the updated images.
- name: Create multi-arch manifest
run: |
docker buildx imagetools create \
-t ${REGISTRY}/${IMAGE}:nightly \
${REGISTRY}/${IMAGE}:nightly-linux-amd64 \
${REGISTRY}/${IMAGE}:nightly-linux-arm64
- name: Verify multi-arch manifest
run: |
docker buildx imagetools inspect ${REGISTRY}/${IMAGE}:nightly