Skip to content

use podman to create and optionally push manifest lists #32

use podman to create and optionally push manifest lists

use podman to create and optionally push manifest lists #32

name: multi-arch image sample
on:
push:
workflow_dispatch:
env:
GITHUB_USERNAME: baronfel
APP_NAME: multi-arch-sample
jobs:
create-multiarch-image:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the code
uses: actions/checkout@v4
- name: Get .NET
uses: actions/setup-dotnet@v4
- name: build the x64 image
id: build-x64
working-directory: src/multi-arch-sample
run: |
dotnet publish -t:PublishContainer --arch x64 -p ContainerImageTag=latest-x64 -p ContainerRepository=${{github.repository_owner}}/${{env.APP_NAME}} -p ContainerRegistry=ghcr.io
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-x64" >> $GITHUB_OUTPUT
- name: build the arm64 image
id: build-arm64
working-directory: src/multi-arch-sample
run: |
dotnet publish -t:PublishContainer --arch arm64 -p ContainerImageTag=latest-arm64 -p ContainerRepository=${{github.repository_owner}}/${{env.APP_NAME}} -p ContainerRegistry=ghcr.io
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-arm64" >> $GITHUB_OUTPUT
- name: create the multi-image manifest
run: |
docker manifest create ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest \
${{ steps.build-x64.outputs.generated_container_name }} \
${{ steps.build-arm64.outputs.generated_container_name }} \
docker manifest push ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest