product-os / flowzone

Reusable, opinionated, zero-conf workflows for GitHub actions
https://flowzone.pages.dev
Apache License 2.0
15 stars 5 forks source link

Add support for multiple buildx bake targets #230

Closed klutchell closed 2 years ago

klutchell commented 2 years ago

We are using docker buildx .hcl files to support advanced docker options like platforms, dockerfile, target stage, etc.

However, this still limits us to one bake target when there are valid use cases for producing multiple image variants by specifying a different context, or dockerfile, or build stage.

By supporting a list of bake targets as an input we could build them all. If more than one is provided we could use the bake target as the prefix in the docker metadata action.

I'll provide examples of how this could work when I get a chance. The current outstanding use case is open-balena-base which currently builds both systemd and non-systemd variants.

klutchell commented 2 years ago

Actually the 'build' target should always be the default and not result in a prefix. Any other target name must inherit build and will use the target name as the prefix.

The tricky bit will be figuring out how to populate the multiple dimensional build matrix for target/platform since each target could have unique platforms.