KiriForge
In developmentKiri Forge
You give Forge a recipe, and it gives back something to run. One build engine for everything Kiri runs, written in Rust and built in the open.
In development, coming to Kiri. Forge is open source and its code is public today; it is not in a released Kiri yet. kiri build stays the command you type.
How it works.
You give Forge a recipe, and it gives back something to run. The recipe becomes a graph of small steps; stages that do not depend on each other run side by side.
- Cached
- Changed
- Rebuilt
COPY src/ step and the steps after it rebuild; the rest comes from the cache.-
01
Planned in a sealed process
The recipe is read in a child process with no files, no network and fixed limits. A hostile recipe can only fail its own build.
-
02
A graph of small steps
A Dockerfile's stages and instructions become steps, each with the image config and history it produces.
-
03
Stages run side by side
Stages that do not depend on each other build at the same time.
-
04
Cached by what each step reads
A step whose inputs have not changed comes straight from the cache. One that has changed is never reused by mistake.
Change one file, rebuild only what read it.
Each step is cached by exactly what it reads: the step itself, its parent and the content of the files it takes in. Here is the same recipe after an edit to src/.
src/- Stage webruns beside api
FROM node AS webCachedCOPY web/ .CachedRUN npm buildCached- Stage apiruns beside web
FROM rust AS apiCachedCOPY Cargo.toml .CachedCOPY src/ ./srcChangedRUN cargo buildRebuilt- Final stagewaits for both
FROM scratchCachedCOPY --from=webCachedCOPY --from=apiRebuilt
This build
- 7
- steps straight from the cache
- 1
- step whose input changed
- 2
- steps after it, run again
What it reads.
Dockerfiles today, WebAssembly next, and Kirifiles after that. One build engine behind kiri build for everything Kiri runs.
-
Today
Dockerfiles
Gives back: OCI images
Reads directives, instructions, heredocs,
.dockerignoreandCOPY/ADDrules, and writes each step's changes as a layer. -
Next
WebAssembly
Gives back: Wasm component / OCI artifact
Next on the roadmap, producing WebAssembly components and OCI artifacts from the same engine.
-
Later
Kirifiles
Status: Planned
Planned after WebAssembly, completing one build engine for everything Kiri runs.
In Kiri, kiri build stays the command you type. Switching Kiri to Forge (kiri builder use forge, coming) is not in a released Kiri yet.
Three ways to use it.
Forge ships as a standalone executable with its own release lifecycle, and as a Rust library you can embed wherever builds run.
Standalone executable
kiri-forge build
Builds Dockerfiles standalone to OCI or Docker tar archives or local directories (-o type=oci|tar|local,dest=...), or against a running Kiri or Docker daemon.
kiri-forge build -t myapp:latest -o type=tar,dest=myapp.tar .
Persistent build worker
kiri-forge worker
A persistent Unix-socket and SCM_RIGHTS build worker for Kiri's engine, so Kiri and Kiri Forge release and update independently.
kiri-forge worker --socket /run/kiri/forge.sock --state /var/lib/kiri/build
Rust library
kiri_forge
The parser, isolated planner, .dockerignore context walker, COPY/ADD engine, layer splicer and ports traits. Running a step, storing layers and pulling base images plug in through three traits.
Cargo.toml
kiri-forge = { git = "https://github.com/
Builds on Linux and macOS (uses Unix file calls).
Built in the open, Apache-2.0.
Kiri Forge's code is public on GitHub under the Apache-2.0 licence. Read the source, run cargo test on Linux or macOS, or follow progress as Forge comes to Kiri.