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

validate metadata flow in multi-stage build #1346

Open
reidpr opened this issue May 17, 2022 · 2 comments
Open

validate metadata flow in multi-stage build #1346

reidpr opened this issue May 17, 2022 · 2 comments

Comments

@reidpr
Copy link
Collaborator

reidpr commented May 17, 2022

When the interpreter executes the 2nd and subsequent FROM in a multi-stage Dockerfile, where is the image metadata (e.g. build environment from ARG and ENV) supposed to come from? I.e., the previous stage, the base image, a merger of the two? I'm not sure we've checked this.

@reidpr
Copy link
Collaborator Author

reidpr commented May 17, 2022

The Dockerfile reference suggests it's the base image:

An ARG instruction goes out of scope at the end of the build stage where it was defined. To use an arg in multiple stages, each stage must include the ARG instruction.

That documentation doesn't say for ENV, but this GitHub issue comment says that's the ENV behavior as well.

I think we do this already, but add a test?

However, the comment also says that global ARG, i.e. before any FROM, does apply to all stages. That would require a merge (and make the build cache not a tree).

@reidpr reidpr removed the uncertain label May 17, 2022
@reidpr
Copy link
Collaborator Author

reidpr commented May 17, 2022

See also issue #779.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant