diff --git a/.github/workflows/publish-linux-docker-image.yml b/.github/workflows/publish-linux-docker-image.yml index f1e5657..820f9d4 100644 --- a/.github/workflows/publish-linux-docker-image.yml +++ b/.github/workflows/publish-linux-docker-image.yml @@ -18,7 +18,12 @@ concurrency: jobs: docker-build: - runs-on: ubuntu-24.04 + runs-on: ${{ matrix.platform }} + strategy: + matrix: + platform: [ ubuntu-24.04, ubuntu-24.04-arm ] + fail-fast: false + permissions: contents: read packages: write @@ -32,17 +37,27 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Compute image tag, and cache scope + - name: Compute image tag, platform, and cache scope id: meta shell: bash run: | - echo "tag=ghcr.io/${{ github.repository_owner }}/ml-sdk-linux-amd64:latest" >> $GITHUB_ENV - - # cache scope (for gha cache) - echo "cache_scope=ml-sdk-linux-amd64" >> $GITHUB_ENV - + arch=$(uname -m) + case "$arch" in + x86_64) arch_tag="amd64"; plat="linux/amd64" ;; + aarch64) arch_tag="arm64"; plat="linux/arm64" ;; + *) echo "Error: unsupported architecture '$arch'" >&2; exit 1 ;; + esac + echo "Architecture detected: $arch" + echo "arch_tag=$arch_tag" >> $GITHUB_ENV + echo "platform=$plat" >> $GITHUB_ENV + + echo "tag=ghcr.io/${{ github.repository_owner }}/ml-sdk-linux-${arch_tag}:latest" >> $GITHUB_ENV + + # per-arch cache scope (for gha cache) + echo "cache_scope=ml-sdk-linux-${arch_tag}" >> $GITHUB_ENV + # separate registry cache tag (DO NOT use the image tag here) - echo "cache_ref=ghcr.io/${{ github.repository_owner }}/ml-sdk-linux-amd64:buildcache" >> $GITHUB_ENV + echo "cache_ref=ghcr.io/${{ github.repository_owner }}/ml-sdk-linux-${arch_tag}:buildcache" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,6 +70,7 @@ jobs: file: docker/Dockerfile tags: ${{ env.tag }} push: true + platforms: ${{ env.platform }} # 1) Share GHA cache across runs with a stable per-arch scope # 2) Also store cache in GHCR under a dedicated cache tag