try docker manifest to merge image in different arch from different r… #263
This file contains hidden or 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: push container for Debian Bookworm | |
on: | |
push: | |
branches: master | |
schedule: | |
- cron: "30 16 * * 0,4" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
image-build-amd64: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
include: | |
# Build AMD64 images on ubuntu-24.04 | |
- debien_image_ver_name: bookworm | |
debien_image_ver_number: 12 | |
- debien_image_ver_name: trixie | |
debien_image_ver_number: 13 | |
steps: | |
- | |
name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.debien_image_ver_name }}-amd64 | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.debien_image_ver_name }}-amd64-${{ steps.date.outputs.date }} | |
platforms: linux/amd64 | |
build-args: | | |
MY_DEBIAN_VERSION=${{ matrix.debien_image_ver_name }} | |
MY_DEBIAN_VERSION_NUMBER=${{ matrix.debien_image_ver_number }} | |
image-build-arm64: | |
runs-on: ubuntu-24.04-arm | |
strategy: | |
matrix: | |
include: | |
# Build ARM64 images on ubuntu-24.04 | |
- debien_image_ver_name: bookworm | |
debien_image_ver_number: 12 | |
- debien_image_ver_name: trixie | |
debien_image_ver_number: 13 | |
steps: | |
- | |
name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.debien_image_ver_name }}-arm64 | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.debien_image_ver_name }}-arm64-${{ steps.date.outputs.date }} | |
platforms: linux/amd64 | |
build-args: | | |
MY_DEBIAN_VERSION=${{ matrix.debien_image_ver_name }} | |
MY_DEBIAN_VERSION_NUMBER=${{ matrix.debien_image_ver_number }} | |
create-manifest: | |
needs: [image-build-amd64, image-build-arm64] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create and Push Manifest for Debian 13 | |
run: | | |
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie-amd64 \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie-arm64 | |
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie-amd64 \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie-arm64 | |
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:trixie | |
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
- name: Create and Push Manifest for Debian 12 | |
run: | | |
docker manifest create ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:bookworm \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:bookworm-amd64 \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:bookworm-arm64 | |
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:bookworm |