pub struct Stage<'a> {
pub index: usize,
pub name: Option<String>,
pub instructions: Vec<&'a Instruction>,
pub parent: StageParent<'a>,
pub root: StageParent<'a>,
}
Expand description
A single stage in a multi-stage build.
A stage begins with (and includes) a FROM
instruction and continues until
(but does not include) the next FROM
instruction, if any.
Stages have an index and an optional alias. Later COPY --from=$index [...]
instructions may copy files between unnamed build stages. The alias, if
defined in this stage’s FROM
instruction, may be used as well.
Note that instructions in a Dockerfile before the first FROM
are not
included in the first stage’s list of instructions.
Fields§
§index: usize
The stage index.
name: Option<String>
The stage’s FROM alias, if any.
instructions: Vec<&'a Instruction>
An ordered list of instructions in this stage.
parent: StageParent<'a>
The direct parent of this stage.
If this is the first stage, it will be equal to the root stage.
root: StageParent<'a>
The root image of this stage, either an external reference (possibly from
a remote registry) or scratch
.
Implementations§
Source§impl<'a> Stage<'a>
impl<'a> Stage<'a>
Sourcepub fn arg_index(&self, name: &str) -> Option<usize>
pub fn arg_index(&self, name: &str) -> Option<usize>
Finds the index, relative to this stage, of an ARG instruction defining the given name. Per the Dockerfile spec, only instructions following the ARG definition in a particular stage will have the value in scope, even if it was a defined globally or in a previous stage.