Open tonistiigi opened 4 years ago
SGTM
Just a thought, what if instead --platform=all
is a shortcut for that does that as an opt-in?
For a second, forget about platforms, assume same platform everywhere.
I think that there are two ideal default behaviors for building on a builder with arbitrary set of nodes:
Today it's neither: we just select the first one in the list, but it may be useful to keep this in mind for future defaults.
Now if you add the platform dimension and consider the scheduling based on least busy policy, the only usecase I can think of is if users can both natively compile and cross compile their code, and want to mix expensive but fast architectures with cheaper but slower architectures, because they found a sweet spot tradeoff between time and cost they could only achieve with different architectures. This is basically platform-agnostic scheduling.
If 1. is no or 2. is yes then I don't think we need --platform=all
and we can simply default to it.
I do not think a nodes capability to build a platform should be implicitly tied to a projects to desire to be built on those platforms.
@cpuguy83 I agree but using --platform
on create
is not required for nodes capability to build a platform. If you don't set it, it will still be detected and works fine. So it is already a sort of opt-in action.
@tonistiigi Perahps so... What if a you can define the default list on the buildx context... and maybe an unset default is all the platforms?
Currently
buildx create --platform
can be used to set manual platforms for the builder instance. This is used to find a node for a specific platform if multiple nodes support it. Eg. your laptop supports arm via emulation but aws node supports it natively so you set aws node's platform manually to ensure arm workloads go there.The proposal is to add an additional meaning to this field. If
buildx build
is used without a build specific--platform
flag it could (instead of sending the request without a platform to the first node) build for all the platforms that were manually set oncreate
. This allows to create a builder instance that creates multi-platform images by default.@tiborvass @cpuguy83 @AkihiroSuda wdyt?