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

Add current target platform as variable #3051

Open
jhg03a opened this issue Mar 6, 2025 · 1 comment
Open

Add current target platform as variable #3051

jhg03a opened this issue Mar 6, 2025 · 1 comment
Labels
kind/enhancement New feature or request status/triage

Comments

@jhg03a
Copy link

jhg03a commented Mar 6, 2025

Description

When compiling a multi-platform target today you can access the platform being compiled as an ARG inside a docker build via TARGETPLATFORM. I need the same information however higher up in the bake file to appropriately assign a cache per platform. Today I cannot do that and due to locking restrictions on debian's package cache as a cache mount, it means that it's not possible to parallelize the particular RUN stage accessing the cache. Additionally having such a magic variable would also allow for better context interpolation as well. If I have separate parent contexts per platform today, I have to mount both to each target and then use a RUN+TARGETPLATFORM switch to copy the right architecture files into place during a multiplatform build.

@jhg03a jhg03a added kind/enhancement New feature or request status/triage labels Mar 6, 2025
@tonistiigi
Copy link
Member

Not quite sure what you are asking here. In bake you can access values of the target (or other targets) directly.

to appropriately assign a cache per platform

--cache-from/to works with multi-platform inputs. You don't need to separate it by arch if your build is multi-platform.

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 status/triage
Projects
None yet
Development

No branches or pull requests

2 participants