Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Docker manifests from different runners #1287

Open
diehard2 opened this issue Dec 20, 2024 · 5 comments
Open

Merge Docker manifests from different runners #1287

diehard2 opened this issue Dec 20, 2024 · 5 comments
Labels
kind/enhancement New feature or request

Comments

@diehard2
Copy link

Description

I've followed the steps here - https://docs.docker.com/build/ci/github-actions/multi-platform/
but I've been unable to get it to work for a custom registry. Its also extremely difficult to both understand and debug

adding an option in this action such as

'merge-manifests' that replaces all of that code would make this far simpler. With more runners allowing for ARM builds, this would let people avoid QEMU emulation and parallelize their build configurations far more easily

@diehard2 diehard2 added kind/enhancement New feature or request status/triage labels Dec 20, 2024
@crazy-max
Copy link
Member

I've followed the steps here - https://docs.docker.com/build/ci/github-actions/multi-platform/
but I've been unable to get it to work for a custom registry.

Can you create a bug report with workflow and logs so we can take a look?

Its also extremely difficult to both understand and debug

Yes this has been raised in #671 as well. We also want to ease distributed builds by using subactions for both build-push-action and bake-action.

'merge-manifests' that replaces all of that code would make this far simpler.

Can you explain how this merge-manifests input would work?

this would let people avoid QEMU emulation

This will not avoid QEMU on GitHub hosted runners, it will just build on a dedicated runner.

@junghans
Copy link

junghans commented Jan 18, 2025

I ran into a similar issue now that the arm64 linux runners ( ubuntu-24.04-arm) are online. Previously arm64 image were out of the question as qemu was too slow and MacOS M1 runner cannot build docker containers.

Using Noelware/docker-manifest-action seems to work.

workflow.yml
jobs:
  build:
    strategy:
      matrix:
        config:
          - {arch: 'arm64'}
          - {arch: 'amd64'}
    runs-on: ${{ matrix.config.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Checkout code    
        uses: actions/checkout@v4
      - name: Build and Push Docker images for all Container Registries
        uses: docker/build-push-action@v6
        with:
          tags: |
            ghcr.io/${{ github.repository }}/build:latest-${{matrix.config.arch}}
          file: Dockerfile 
          push: true
  merge-docker-manifest:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Create and push manifest images
        uses: Noelware/docker-manifest-action@master # or use a pinned version in the Releases tab
        with:
          inputs: ghcr.io/${{ github.repository }}/build:latest
          images: ghcr.io/${{ github.repository }}/build:latest-amd64,ghcr.io/${{ github.repository }}/build:latest-arm64           
        push: true

@crazy-max
Copy link
Member

now that the amd64 linux runners ( ubuntu-24.04-arm) are online

I guess you meant arm64 and yes we are going to update our docs related to these new runners but will not be up until these runners are GA.

Using Noelware/docker-manifest-action seems to work.

Your workflow creates multiple tags with architecture suffix which is not the desired behavior. In our case https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners we are pushing by digest to avoid that. Don't think Noelware/docker-manifest-action supports merging these manifests though as it's using docker manifest command: https://github.com/Noelware/docker-manifest-action/blob/a34eba526b9e4f02939cd3385b52f9cdef9bdf99/src/index.ts#L69

@bo0tzz
Copy link

bo0tzz commented Jan 18, 2025

Your workflow creates multiple tags with architecture suffix which is not the desired behavior.

I don't think that's the case, but that the arguments are very unclearly named. As I understand it, the architecture suffix tags are the inputs that get merged into one final manifest without a specific arch suffix.

@junghans
Copy link

now that the amd64 linux runners ( ubuntu-24.04-arm) are online

I guess you meant arm64 and yes we are going to update our docs related to these new runners but will not be up until these runners are GA.

Yes, typo!

Using Noelware/docker-manifest-action seems to work.

Your workflow creates multiple tags with architecture suffix which is not the desired behavior. In our case https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners we are pushing by digest to avoid that. Don't think Noelware/docker-manifest-action supports merging these manifests though as it's using docker manifest command: https://github.com/Noelware/docker-manifest-action/blob/a34eba526b9e4f02939cd3385b52f9cdef9bdf99/src/index.ts#L69

Yeah, I would like to avoid having the extra tags, but right now I can live with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants