KiriForge

0.1.3

Kiri Forge

Kiri Forge builds the Dockerfiles you already have and gives you the same image docker build gives you. It remembers what it has already done, down to the single file, so a rebuild finishes in milliseconds. One binary, no daemon, written from scratch in Rust.

Install Script

curl -fsSL https://runkiri.com/forge/install.sh | bash

Installs to ~/.local/bin, checks the download's SHA-256, no sudo. macOS and Linux.

Homebrew

brew install libracoder/kiri/kiri-forge

Installs the prebuilt binary from the Kiri tap. macOS and Linux.

Windows

curl -fsSL https://runkiri.com/forge/install.sh | bash

Forge runs inside WSL 2. Run this in a WSL terminal.

GitHub Actions

- uses: libracoder/kiri-forge-action@v1
  with:
    tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
    push: true
    cache-registry: ghcr.io/${{ github.repository }}:cache

One step on a Linux runner: it installs kfg, checks the download and builds. Every input, and what works on Mac runners.

Full install instructions

The first build of the three-line example in the README, replayed at the speed it ran.

How it works.

Forge parses the Dockerfile and plans the build in a sealed process. The plan is a graph of small steps; stages that do not depend on each other run side by side.

Dockerfile to OCI image
  • Cached
  • Changed
  • Rebuilt
Dockerfile Plan sealed STAGE WEB STAGE API side by side FROM node COPY web/ RUN build FROM rust COPY src/changed RUN buildrebuilt COPY --fromfinal stage OCI image ready to run
Two stages run side by side. Only the changed COPY src/ step and the steps after it rebuild; the rest comes from the cache.

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 Dockerfile after an edit to src/.

DockerfileYou edited src/
  1. Stage webruns beside api
  2. FROM node AS webCached
  3. COPY web/ .Cached
  4. RUN npm buildCached
  5. Stage apiruns beside web
  6. FROM rust AS apiCached
  7. COPY Cargo.toml .Cached
  8. COPY src/ ./srcChanged
  9. RUN cargo buildRebuilt
  10. Final stagewaits for both
  11. FROM scratchCached
  12. COPY --from=webCached
  13. COPY --from=apiRebuilt

This build

7
steps straight from the cache
1
step whose input changed
2
steps after it, run again
OCI imageready to run

What it reads.

Dockerfiles today, WebAssembly next, and Kirifiles after that. One build engine behind kiri build for everything Kiri runs.

  1. Today

    Dockerfiles

    Output: OCI images

    Reads directives, instructions, heredocs, .dockerignore and COPY/ADD rules, and writes each step's changes as a layer.

  2. Next

    WebAssembly

    Output: Wasm component / OCI artifact

    Next on the roadmap, producing WebAssembly components and OCI artifacts from the same engine.

  3. Later

    Kirifiles

    Status: Planned

    Planned after WebAssembly, completing one build engine for everything Kiri runs.

In Kiri 0.3.0 and later, kiri build uses Forge by default and puts kfg on your PATH; a build Forge cannot do yet goes to BuildKit. Switch builders with kiri builder use buildkit (or in Settings → Builds), and update Forge anytime with kiri builder update.

Install Kiri Forge.

Kiri 0.3.0 and later already include Forge and put kfg on your PATH. To use Forge on its own without Kiri or Docker, install kfg on macOS, Linux or Windows through WSL 2.

macOS and Linux

Install script

Installs to ~/.local/bin, checks the download's SHA-256, no sudo.

curl -fsSL https://runkiri.com/forge/install.sh | bash

Homebrew

macOS and Linux

Installs the prebuilt binary from the Kiri tap.

brew install libracoder/kiri/kiri-forge

Windows

Forge runs inside WSL 2

Run the Linux install command in a WSL terminal.

curl -fsSL https://runkiri.com/forge/install.sh | bash

Check it works

kfg version

kfg build -t myapp:latest -o type=tar,dest=myapp.tar .

Update a standalone install anytime with kfg update (inside Kiri, kiri builder update). Manual downloads and SHA256SUMS are on GitHub Releases.

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

kfg build

Builds Dockerfiles standalone to its own store, a container registry (--push), OCI or Docker tar archives or a local folder (-o type=oci|docker|local,dest=...), or against a running Kiri or Docker engine.

kfg build -t myapp:latest -o type=tar,dest=myapp.tar .

Persistent build worker

kfg worker

A persistent Unix-socket and SCM_RIGHTS build worker for Kiri's engine, so Kiri and Kiri Forge release and update independently.

kfg 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/libracoder/kiri-forge", tag = "v0.1.3" }

Builds on Linux and macOS (uses Unix file calls).

FAQ

Can Kiri Forge replace Docker Buildx and BuildKit?

For standard Dockerfiles, yes. Kiri Forge builds the Dockerfiles you already have with the same common flags as docker buildx build and follows BuildKit's rules so the image config, history and layers come out the same. Custom non-Dockerfile # syntax frontends, docker buildx bake files, and cache backends other than local, registry and inline are not supported yet.

How does Kiri Forge's build cache work?

Each step is cached by what it reads: the step itself, its parent and the content of the files it takes in. Forge remembers the last walk of your build folder on disk and splices unchanged files out of the previous COPY layer when one file changes. Instructions that only set image metadata, such as ENV, ARG, LABEL, EXPOSE, USER and CMD, do not spoil the cache for later steps that never read them, so rebuilds finish in milliseconds.

Do I need Docker or a daemon running to build a Dockerfile?

On Linux, no. Kiri Forge is one Rust binary with no daemon and no builder container to start; it pulls base images, runs RUN steps in its own namespace sandbox and writes OCI images to its store, a registry, a tar file or a folder. On macOS, Dockerfiles without RUN run on macOS alone, and RUN steps use whichever Linux container engine is running, such as Kiri, Docker Desktop, OrbStack, Colima or Rancher Desktop. On Windows, Forge runs inside WSL 2.

Can I share the Docker build cache in CI?

Yes. Pass --cache-from and --cache-to with type=registry to keep the cache in your container registry next to the image, or type=local to store it in a folder your CI restores. On GitHub Actions, the libracoder/kiri-forge-action@v1 step installs kfg, checks the download and builds with a registry cache.

Does Kiri Forge make every step inside a Dockerfile faster?

No. Forge removes daemon overhead, runs independent stages side by side and avoids redoing steps whose inputs have not changed. It does not speed up the commands inside an uncached RUN step, so a compile or download that is not cached takes about as long as it does with BuildKit.

Open source

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 open an issue when a Dockerfile behaves differently from BuildKit.

Status
0.1.3, released 30 November 2026
Language
Rust (Linux and macOS)
Licence
Apache-2.0
Command in Kiri
kiri build