Skip to main content
Use targets in build.yml to turn repository sources into Docker Buildx Bake targets.

Required build target

Each build.yml must contain exactly one target with type: build.
The generator validates this rule during buildcharts generate.

Multiple stages per target

Use a sequence when the same source path should run through multiple stages:
Each type must match an alias in charts/buildcharts/Chart.yaml.

Share settings across stages

Use type: [build, test] when multiple stages share the same with configuration:
The generator expands this shorthand into separate stage definitions.

Configure stage settings

The generator recognizes these keys under with: Example:

Configure build contexts

Use with.contexts to pass Docker Bake named contexts into a target. The common base context lets a chart Dockerfile choose its base image without hardcoding it in the chart:
Use types.<type>.contexts when every target of a type should receive the same context:
The context name build is reserved. BuildCharts automatically connects non-build targets to the generated build target as target:build.

Shared variables

Use top-level variables for values reused across generated targets, such as image tags or version metadata.
Reference variables from stage settings with ${VARIABLE}:
Map variables through with.args when a chart expects a custom build arg name:
Variables become Bake variables and are also passed to chart Dockerfiles as build args through the generated _common target.

Use built-in build args

Every generated target also gets a small set of built-in build args. For example:
The generator injects:

Pass custom build arguments

Use with.args for chart-specific Dockerfile ARGs. Values can be literals or variable references. Dockerfile example:
build.yml example:
The generator writes these values into the generated Bake target, so the chart Dockerfile receives them as standard build args at execution time.

Expand stages with a matrix

Use types.<type>.matrix when every target of the same type should fan out across a matrix:
Each matrix axis is expanded into multiple generated Bake variants for that type, and every axis value is exposed to the chart as an uppercase build arg. For example, this metadata:
becomes a generated Bake matrix for publish where:
  • The same source target is reused
  • The runtime axis expands into one variant per value
  • The generated target name includes the matrix value
  • The chart receives RUNTIME as a build arg
In practice, that one type: publish entry turns into two generated publish variants, one for win-x64 and one for win-arm64. This is conceptually similar to: The difference is that BuildCharts expands the matrix into Docker Buildx Bake targets instead of CI jobs. Matrix values become Bake target variants and build args that chart Dockerfiles can consume. Read more about Docker matrix targets.

Read values in a chart Dockerfile

Declare an ARG for each built-in arg, shared variable, or with.args value the chart needs to consume:
Last modified on June 2, 2026