targets in build.yml to turn repository sources into Docker Buildx Bake targets.
Required build target
Eachbuild.yml must contain exactly one target with type: build.
buildcharts generate.
Multiple stages per target
Use a sequence when the same source path should run through multiple stages:type must match an alias in charts/buildcharts/Chart.yaml.
Share settings across stages
Usetype: [build, test] when multiple stages share the same with configuration:
Configure stage settings
The generator recognizes these keys underwith:
Example:
Configure build contexts
Usewith.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:
types.<type>.contexts when every target of a type should receive the same context:
build is reserved. BuildCharts automatically connects non-build targets to the generated build target as target:build.
Shared variables
Use top-levelvariables for values reused across generated targets, such as image tags or version metadata.
${VARIABLE}:
with.args when a chart expects a custom build arg name:
_common target.
Use built-in build args
Every generated target also gets a small set of built-in build args. For example:Pass custom build arguments
Usewith.args for chart-specific Dockerfile ARGs. Values can be literals or variable references.
Dockerfile example:
build.yml example:
Expand stages with a matrix
Usetypes.<type>.matrix when every target of the same type should fan out across a matrix:
publish where:
- The same source target is reused
- The
runtimeaxis expands into one variant per value - The generated target name includes the matrix value
- The chart receives
RUNTIMEas a build arg
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 anARG for each built-in arg, shared variable, or with.args value the chart needs to consume:
