Description
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug, and:
- The documentation does not mention anything about my problem
- There are no open or closed issues that are related to my problem
Description
Single arch images are generated with a manifest list, not allowing them to be merged later.
Expected behaviour
Single platform images built through bake-file should not contain a manifest list.
I know I can use emulation to build images on a single machine however the emulation process is not optimal usually taking much longer to complete. Trying to leverage specific runners (ie ARM) to build separate images and then merge the manifests. I have a way to do this however I am unable to merge the manifests as the images generated from the bake action are is a manifest list
already.
Using build-push-action
would work but this repo leverages a number of features from the bake file that I would like to keep.
Actual behaviour
Resulting images are full manufest lists even when single platform is built.
Repository URL
No response
Workflow run URL
No response
YAML workflow
My approach is as follows (let me know if there is a more optimal way of doing this)
bake-build-arm:
name: bake-build-arm
runs-on: arm-runner
permissions:
packages: write
contents: read
steps:
# 2.1 - Generate Image Metadata
- name: Docker meta
id: meta
uses: docker/metadata-action@v5.7.0
with:
images: ghcr.io/${{ github.repository }}/${{ inputs.image }}
tags: |
type=raw,value=${{ inputs.tag }}
flavor: |
latest=false
suffix=--arm64
# 2.2 - Login against the docker registry
- name: Login to registry GHCR
...
# 2.3 - Setup Docker BuildX for multi platform building
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.10.0
# 2.4 - Build Docker Images
- name: Build Images using BuildX Bake
uses: docker/bake-action@v6.5.0
with:
files: |
"docker-bake.hcl"
cwd://${{ steps.meta.outputs.bake-file }}
targets: ${{ inputs.image }}
push: true
set: |
*.cache-from=type=gha,scope=build-${{ inputs.image }}
*.cache-to=type=gha,scope=build-${{ inputs.image }},mode=max
*.platform=linux/arm64
Same for the AMD version but generates a `--amd64` tag
Then in a later stage I try to merge the two using
docker manifest create ${{ inputs.name }} \
--amend ${{ inputs.name }}--amd64 \
--amend ${{ inputs.name }}--arm64
But it fails stating that `--amd64 is a manifest list` (same for arm64)
When I manually inspect them, indeed I see that it contains a manifest array. Is there a way to override that so that it builds the same single image as `build-push-action` does?
Workflow logs
Run docker manifest create ghcr.io/org-xyz/repo-123/image-abc:7.4.2 \
docker manifest create ghcr.io/org-xyz/repo-123/image-abc:7.4.2 \
--amend ghcr.io/org-xyz/repo-123/image-abc:7.4.2--amd64 \
--amend ghcr.io/org-xyz/repo-123/image-abc:7.4.2--arm64
docker manifest annotate --arch amd64 --os linux ghcr.io/org-xyz/repo-123/image-abc:7.4.2 ghcr.io/org-xyz/repo-123/image-abc:7.4.2--amd64
docker manifest annotate --arch arm64 --os linux ghcr.io/org-xyz/repo-123/image-abc:7.4.2 ghcr.io/org-xyz/repo-123/image-abc:7.4.2--arm64
shell: /usr/bin/bash -e {0}
ghcr.io/org-xyz/repo-123/image-abc:7.4.2--amd64 is a manifest list
Error: Process completed with exit code 1.
BuildKit logs
Additional info
No response