feat: use current buildx builder
What I did
Use the logic from buildx to select the current builder instance to support using different instances.
This is essentially copying https://github.com/docker/buildx/blob/v0.8.1/commands/build.go#L241 to compose as buildx currently doesn't expose this logic.
I'm not entirely sure how to test those changes (make test is still passing), but I can't see any dedicated buildx tests or a way to test using different builders.
Related issue
Fixes https://github.com/docker/compose/issues/8531
(not mandatory) A picture of a cute animal, if possible in relation with what you did

I wonder if we can ask Buildx maintainers to export this method through an existing API or command. I prefer to avoid code duplication and get benefit from Buildx future releases without having to backport code. WDYT @ndeloof @ulyssessouza @crazy-max @tonistiigi ?
We copy/pasted code from buildx as compose v2 was not yet an established long term plan for compose but we needed support for build. So it would make perfect sense now we avoid this and use an exported higher level function so we only have to prepare build options, and give buildx a dockercli reference. Just like we did for docker/cli exec and run
Pushed an update to fix the lint issue.
Any update here, anything I can do to move this forward?
Rebased, anything else I should be doing here? We would still love to use compose with gha build caching and without this change it makes this fairly complicated.
@ndeloof / @crazy-max any way I could help to move this forward? That would be 🤩
Hi there! Any news?
^^ seconding that, any news? this would be great to fix!
+1 I also got bit by this and have the same motivation being discussed in #8531: enabling caching in GitHub Actions.
Replaced by https://github.com/docker/compose/pull/9729