v1

Build /

Inject build arguments

Available on combined and build services.

Build arguments (ARG) can be set to be passed to the Docker container at build-time. These can be set for individual builds on the build arguments page or set as project secrets to be applied to all or specific builds in a project.

Although unlikely, some buildpacks may override your build arguments.

If using a Dockerfile, build arguments will be passed to the Dockerfile on build via the --build-arg flag. They do not persist in the built image and are set as key-value pairs. Variables must be declared in the Dockerfile with ARG before being accessed. For example, a variable set as PACKAGES=npm-cache can be accessed in the Dockerfile by declaring the ARG:

ARG PACKAGES
# or initialise with a default value:
# ARG PACKAGES=default_value

RUN echo "Using: ${PACKAGES}"

Build arguments can be set as key-value pairs, or as JSON in the following format:

{
    "KEY_1": "value1",
    "KEY_2": "value2"
}

An .env file can also be uploaded and edited using the following format:

KEY_1=value1
KEY_2=value2

© 2022 Northflank Ltd. All rights reserved.