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 the ARM Docker images into the existing images (multi-platform images) #62

Open
mnapoli opened this issue Mar 10, 2023 · 6 comments · Fixed by #65
Open

Merge the ARM Docker images into the existing images (multi-platform images) #62

mnapoli opened this issue Mar 10, 2023 · 6 comments · Fixed by #65
Assignees

Comments

@mnapoli
Copy link
Member

mnapoli commented Mar 10, 2023

See brefphp/bref#1043 (comment) and the discussion.

@mnapoli
Copy link
Member Author

mnapoli commented Mar 14, 2023

This is more complex than I anticipated. Currently blocked on this: docker/buildx#59 (comment)

What this issue means is that it's impossible/hard to build multi-platform images locally, then run tests/export layers, then push to Docker Hub. Currently multi-platform images MUST be pushed immediately to Docker Hub.

I will revert to separate images for the Bref v2.0 release, and will later work on unifying them.

@shouze
Copy link

shouze commented Mar 14, 2023

@mnapoli you also have the option to use docker manifest create.

An example: https://stackoverflow.com/a/70306574

So the idea would be to keep building separately tagged images (eg php-82-x86, php-82-arm64). Then triggering a manifest create workflow dispatch at the end of any build workflow of a given arch.

The manifest create workflow should be able to gently fail depending of the builds race condition. But when it is triggered at the time you have all archs images built & tagged, then you're ready to merge then thanks to docker manifest create command and then push them.

Final note: in fact when you trigger the manifest create github action workflow, best option is to pass docker image couple of unique hashs, not named tags.

@mnapoli mnapoli changed the title Merge the ARM Docker images into the existing images Merge the ARM Docker images into the existing images (multi-platform images) Mar 14, 2023
@mnapoli
Copy link
Member Author

mnapoli commented Mar 14, 2023

Thanks!

On a side note: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-reqs

Lambda provides multi-architecture base images. However, the image you build for your function must target only one of the architectures. Lambda does not support functions that use multi-architecture container images.

Do you think that will be an issue for users? I'm thinking that users that deploy using Docker will re-build their images anyway, but I'm not 100% sure they won't be impacted 🤔

@shouze
Copy link

shouze commented Mar 14, 2023

Well, yes users will build their own image when deploying docker image so the image they will build will be mono arch by default (because new image build means new docker manifest from scratch).

@mnapoli
Copy link
Member Author

mnapoli commented Mar 14, 2023

Awesome thanks for confirming.

@mnapoli
Copy link
Member Author

mnapoli commented May 20, 2023

Spent some more time on this. From my understanding Depot doesn't have the problem (only Docker buildx does).

Here are some options I've identified

  • dig into docker manifest -> if I can avoid it, I'd prefer, that's introducing yet another concept and another step, adding complexity
  • build platforms separately, then run tests, then build + push together (cache will be reused)
    • In CI for tests, we could run tests just like on master, i.e. separate platforms
    • In CI for releasing, we are using Depot, so we could build multiple platforms at once (we could also skip running tests and instead have a dependency on the "tests" workflow)
    • Locally, we could have an error printed if trying to build without CPU=xxx (when not using Depot)

I need to spend a lot more time on this, for those following this issue don't expect a speedy resolution (unless your company can sponsor that work 😬)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants