Skip to main content

expand_variables

Function expand_variables 

Source
pub fn expand_variables(
    input: &str,
    args: &HashMap<String, String>,
    env: &HashMap<String, String>,
) -> String
Expand description

Expand variables in a string using the provided ARG and ENV maps.

Variables are expanded in the following order of precedence:

  1. Build-time ARGs (provided at build time)
  2. ENV variables (from Dockerfile ENV instructions)
  3. Default ARG values (from Dockerfile ARG instructions)

§Arguments

  • input - The string containing variable references
  • args - ARG variable values (build-time and defaults)
  • env - ENV variable values

§Returns

The string with all variables expanded