charliecloud
charliecloud copied to clipboard
validate metadata flow in multi-stage build
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.
The Dockerfile reference suggests it's the base image:
An
ARGinstruction 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 theARGinstruction.
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).
See also issue #779.