Use build.yml to describe what your repository should build. The generator reads this file from the repository root.
Schema
Use the shipped schema for editor validation:
# yaml-language-server: $schema=https://raw.githubusercontent.com/eddietisma/buildcharts/main/schemas/v1beta.json
Top-level fields
version
String value for the config version. The repository samples use v1beta.
variables
Variables become Bake variables and are also exposed through the generated _common target args.
Supported forms:
variables:
- VERSION
- COMMIT
variables:
- VERSION: "1.0.0-local"
- COMMIT: ""
variables:
- VERSION:
default: "1.0.0-local"
- COMMIT: ""
variables:
VERSION: "1.0.0-local"
COMMIT: ""
plugins
Optional list of plugin names:
plugins:
- NuGetAuthenticate@v1
- TestcontainersDinD@v1
targets
Required mapping of source path to one or more target definitions.
You must define exactly one build target across the whole file.
Supported forms:
Single scalar:
targets:
buildcharts.sln: build
Mapping with one type:
targets:
src/App/App.csproj:
type: docker
with:
base: mcr.microsoft.com/dotnet/runtime:10.0
tags: ["docker.io/example/app:${VERSION}-${COMMIT}"]
Mapping with multiple types that share the same with block:
targets:
src/App/App.csproj:
type: [build, test]
with:
base: mcr.microsoft.com/dotnet/sdk:10.0
Sequence of entries:
targets:
src/App/App.csproj:
- type: build
with:
base: mcr.microsoft.com/dotnet/sdk:10.0
- type: docker
with:
base: mcr.microsoft.com/dotnet/runtime:10.0
tags: ["docker.io/example/app:${VERSION}-${COMMIT}"]
types
Optional type-level matrix expansion.
Use types.<type>.matrix when you want to expand every target of a given type across one or more axes:
types:
docker:
matrix:
platform: ["linux/amd64", "linux/arm64"]
Every target of that type is expanded across the matrix axes. Each axis value is exposed to the chart as an uppercase snake case build arg.
For example, this metadata:
targets:
src/dotnet-krp/dotnet-krp.csproj:
- type: publish
types:
publish:
matrix:
runtime: ["win-x64", "win-arm64"]
produces one generated Bake target per matrix value. In the generated docker-bake.hcl, the publish target becomes a Bake matrix with:
- one
item entry for the source target
- one
runtime axis with both values
- a target name pattern such as
${item.name}_${runtime}
- an injected build arg
RUNTIME="${runtime}"
That means a single type: publish definition expands into two generated publish variants, one for win-x64 and one for win-arm64.
with keys recognized by the current generator
The schema allows free-form objects under with, but the current generator emits these keys into the Bake plan:
| Key | Effect |
|---|
base | Adds a named base context using docker-image://... |
tags | Sets Bake tags for the generated target |
dockerfile | Overrides the default chart Dockerfile path |
allow | Sets BuildKit entitlements such as network.host |
args | Adds per-target build args |
Notes:
args values can be strings or arrays
- Array values are emitted as comma-separated strings in the generated HCL
- If you omit
dockerfile, BuildCharts uses ./.buildcharts/<chart-name>/Dockerfile
Alias resolution
Each target type must match an alias in charts/buildcharts/Chart.yaml. If you define type: publish, you also need a chart dependency whose alias is publish.
Example
version: latest
variables:
- VERSION
- COMMIT
plugins:
- NuGetAuthenticate@v1
targets:
buildcharts.sln:
type: build
with:
base: mcr.microsoft.com/dotnet/sdk:10.0
src/BuildCharts.Tool/BuildCharts.Tool.csproj:
- type: test
with:
base: mcr.microsoft.com/dotnet/sdk:10.0
- type: docker
with:
base: mcr.microsoft.com/dotnet/runtime:10.0
tags: ["docker.io/buildcharts/buildcharts:${VERSION}-${COMMIT}"]
args:
RUNTIME: "linux-x64"
types:
docker:
matrix:
platform: ["linux/amd64", "linux/arm64"]
Last modified on March 16, 2026