Skip to content

About

The modern image builder for containers. Builds your Dockerfiles up to 30× faster than BuildKit, as one binary with no daemon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

49 stars

Watchers

0 watching

Forks

Kiri Forge: up to 30× faster than BuildKit. Reduce your CI bill by 20 to 80%.

Kiri Forge: the modern image builder for containers

Cut your image build time by up to 90%, on your laptop and in CI.

Forge builds the Dockerfiles you already have and gives you the same image docker build gives you. It is written from scratch in Rust, ships as one binary and needs no daemon. On the same Dockerfiles it finishes up to 30× sooner than BuildKit.

How fast

The same Dockerfiles, built by Kiri Forge, by BuildKit on its own (buildctl) and by docker buildx:

Build Kiri Forge Against BuildKit Against docker buildx
First build, base images already on the machine 0.44 s for all 10 23× faster (10.21 s) 21× faster (9.24 s)
Rebuild after editing one file 30 to 81 ms each 19× faster 16× faster
Rebuild with nothing changed 14 to 43 ms each 39× faster 31× faster
Empty machine: pull the base images, then build 6.1 s 1.8× faster (11.2 s) 2.4× faster (14.3 s)

How we measured: Dockerfiles from 10 well-known open-source repositories (nginx-proxy, Harbor, Grafana, Selenium, the OpenTelemetry demo, Apache Airflow, Confluent Platform, Debezium, docker-elk and Awesome Compose), each build timed three times and the median taken, on a Linux x86_64 machine with 4 CPUs. The engines were Kiri Forge 0.1.0, BuildKit 0.35.1 and docker buildx 0.39.1 on Docker Engine 29.10.1. The one-file row covers the 7 projects that copy local files, and the averages in the middle two rows are geometric means. The last row is one project, nginx-proxy, with every image and cache wiped first.

What the numbers mean. These are small builds: BuildKit needs about a second for each, nearly all of it the engine's own overhead, and Forge needs tens of milliseconds. That overhead, and every piece of work that has already been done, is what Forge removes, and it is most of what a build does the second time. Forge does not make the commands inside your Dockerfile run faster. A step that compiles for a minute still compiles for a minute, so a first build dominated by one long RUN gains little.

Time it on your own project:

time kfg build --standalone --no-cache -t bench:forge .
time docker buildx build --no-cache -t bench:buildx --load .

Run each a second time without --no-cache to compare rebuilds.

Why Forge

  • Fast on every build after the first. Forge remembers what it has already done, down to the single file, so a rebuild finishes in milliseconds.
  • One binary, no daemon. Nothing to start, nothing to keep running, no builder image to pull. kfg build is one process that exits when the image is done.
  • Your Dockerfiles and your flags. -t, -f, --build-arg, --target, --platform, --secret, --ssh, --cache-from, --cache-to and --push mean what they mean in docker buildx build.
  • The same image. Forge follows BuildKit v0.33.1's rules so that the image config, the history and the layers come out the same, byte for byte where it can. It is checked against thousands of recorded BuildKit answers.
  • Safe with a Dockerfile you did not write. The Dockerfile is read and planned in a sealed process, and RUN steps execute in a sandbox with its own namespaces. If the sandbox cannot be set up, Forge refuses to run the step; it never falls back to running it on the host.
  • Alone or inside Kiri. The same engine builds from the command line and inside Kiri.

Install

On its own, Kiri Forge needs nothing else: install kfg below and build. Inside Kiri it requires Kiri 0.3.0 or later; see Inside Kiri.

Homebrew

On macOS and Linux:

brew install libracoder/kiri/forge
kfg version

On Homebrew 7 and newer, trust the tap first with brew trust libracoder/kiri.

Download a release

Forge is one file. Releases are built for Linux (x86_64 and aarch64) and macOS (Apple silicon and Intel). This picks the right one for your machine, checks it and puts it on your PATH:

VERSION=0.1.3
FILE="kiri-forge-$VERSION-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz"
curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$VERSION/$FILE"
curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$VERSION/SHA256SUMS"
sha256sum --check --ignore-missing SHA256SUMS   # macOS: shasum -a 256 --check --ignore-missing SHA256SUMS
tar -xzf "$FILE" kiri-forge
sudo mkdir -p /usr/local/bin
sudo install -m 0755 kiri-forge /usr/local/bin/kiri-forge
sudo ln -sf kiri-forge /usr/local/bin/kfg
kfg version

The last line prints the version and your platform. The macOS binaries are signed with a Developer ID and notarised by Apple. To install without sudo, put the file and the link in any folder on your PATH, such as ~/.local/bin.

Two names, one program

kfg is the command you type. kiri-forge is the same program under its long name: it is what the release file holds, and what Kiri's engine looks for. Each shows its own name in its help and messages, and they share one store.

If you would rather type forge, alias forge=kfg in your ~/.bashrc or ~/.zshrc does it. Skip that if you use Foundry, whose command is also called forge.

Build from source

With Rust 1.88 or newer:

git clone https://github.com/libracoder/kiri-forge
cd kiri-forge
cargo build --release
sudo install -m 0755 target/release/kfg target/release/kiri-forge /usr/local/bin/

Update it

kfg update --check    # see whether a newer release is out
kfg update            # verify and install it (add sudo if installed in /usr/local/bin)

If you installed with Homebrew, run brew upgrade kiri-forge instead; inside Kiri, run kiri builder update.

Remove it

Forge is a file, a link and a folder, so removing it is deleting those. There is no uninstall command.

kfg du                                            # optional: see what the store holds first
brew uninstall kiri-forge                         # if installed with Homebrew
sudo rm -f /usr/local/bin/kfg /usr/local/bin/kiri-forge
rm -rf ~/.local/share/kiri-forge                  # your store: images and build cache
sudo rm -rf /var/lib/kiri-forge                   # root's store, if you built with sudo

If you set KIRI_FORGE_STATE or XDG_DATA_HOME, the store is there instead. On Ubuntu, also remove the profile if you added it: sudo apparmor_parser -R /etc/apparmor.d/kiri-forge && sudo rm -f /etc/apparmor.d/kiri-forge. Images you loaded into Docker or pushed to a registry are not touched.

Where it runs

System What works
Linux, as root Everything, with zero daemon.
Linux, as an ordinary user Everything, once the kernel lets you create user namespaces. Fedora allows it out of the box. Ubuntu 24.04 and later block it with AppArmor: see below.
macOS Everything: Dockerfiles without RUN run on macOS alone, and RUN steps automatically use whichever Linux container engine is on your Mac (OrbStack, Docker Desktop, Colima, Rancher Desktop, or Kiri, respecting DOCKER_HOST and your active docker context).

Ubuntu. Without a profile, a build stops with rootless Linux container sandbox blocked by Ubuntu AppArmor. Either run the build with sudo, or give Forge a profile once:

sudo tee /etc/apparmor.d/kiri-forge >/dev/null <<'EOF'
abi <abi/4.0>,
include <tunables/global>

profile kiri-forge /usr/local/bin/{kiri-forge,kfg} flags=(unconfined) {
  userns,
  include if exists <local/kiri-forge>
}
EOF
sudo apparmor_parser -r /etc/apparmor.d/kiri-forge

More than one user in the image. As an ordinary user, Forge maps a full range of 65,536 user ids when newuidmap and newgidmap are installed (the uidmap package) and your user has a range in /etc/subuid and /etc/subgid. Without them only root exists inside the build, and a step that switches to another user can fail.

Build your first image

Make a folder with two files:

mkdir hello && cd hello

echo "Built with Kiri Forge" > hello.txt

cat > Dockerfile <<'EOF'
FROM alpine:3.21
RUN apk add --no-cache curl
COPY hello.txt /hello.txt
CMD ["cat", "/hello.txt"]
EOF

Build it:

kfg build --standalone -t hello:latest .
◆ Kiri Forge  hello:latest · linux/arm64

  ✓ FROM alpine:3.21                                                       2.0s
  ✓ RUN apk add --no-cache curl                                            3.5s
  ✓ COPY hello.txt /hello.txt                                              0.0s

  ✓ Built hello:latest in 7.0s
    13 MB · 3 layers · sha256:f387d9ab138e
    slowest step: RUN apk add --no-cache curl (3.5s)

In a terminal the build is drawn live: every step has a row from the start, with a timer on the one that is running and a line for the download while layers come in. In CI, or when the output is piped, the same build prints BuildKit's plain log (#5 [2/3] RUN ...), because scripts read that. --progress plain asks for the plain log in a terminal too.

--standalone tells Forge to do the whole build itself: it pulls alpine with its own registry client, runs the RUN step in its own sandbox and keeps the image in its own store. There is no engine to start first.

Now see what a rebuild costs. Run the same command again: nothing changed, so nothing runs. Then change hello.txt and build once more: the RUN step is still cached and only the COPY is redone.

◆ Kiri Forge  hello:latest · linux/arm64

  ✓ 3 steps, all cached

  ✓ Up to date: hello:latest in 5 ms
    13 MB · 3 layers · sha256:f387d9ab138e

On our test machine the rebuild with nothing changed took 5 ms and the one after the edit took 10 ms.

The image is in Forge's store:

kfg images
REPOSITORY:TAG    IMAGE ID               PLATFORM       SIZE       CREATED
hello:latest      sha256:8a1ad53f529a    linux/arm64    12.9MiB    2026-11-29T13:40:13.183485264Z

To run it, hand it to something that runs containers:

# Docker on this machine: build and load in one go, then run
kfg build --standalone --load -t hello:latest .
docker run --rm hello:latest          # prints: Built with Kiri Forge

# or write a file that docker load reads
kfg build --standalone -t hello:latest -o type=docker,dest=hello.tar .
docker load -i hello.tar

# or push it to a registry
kfg build --standalone -t registry.example.com/you/hello:latest --push .

Everyday use

Where the build runs

You run What happens
kfg build --standalone ... Forge does everything itself, as above. The same on every machine.
kfg build ..., no engine on the machine The same as --standalone.
kfg build ..., Kiri running The build is sent to Kiri's engine, which builds it with Forge.
kfg build ..., only Docker running Forge builds in its own process, runs RUN steps as Docker containers and loads the image into Docker.

Forge looks for an engine at DOCKER_HOST, KIRI_SOCKET, your active docker context (~/.docker/config.json), then Kiri's, Docker's, OrbStack's or Colima's socket. Pass --standalone whenever you want the build to keep its cache and images in Forge's own store rather than delegating to an engine, which is what you want in scripts and CI.

Push to a registry

docker login ghcr.io
kfg build --standalone -t ghcr.io/you/app:1.0 --push .

Forge reads your logins from ~/.docker/config.json (or $DOCKER_CONFIG), credential helpers included, so docker login is all it needs. For a registry on plain HTTP or with a self-signed certificate, add --insecure-registry host:port.

Share the build cache between machines

Keep the cache in a registry, next to the image:

kfg build --standalone -t ghcr.io/you/app:1.0 \
  --cache-from type=registry,ref=ghcr.io/you/app:cache,ignore-error=true \
  --cache-to type=registry,ref=ghcr.io/you/app:cache,mode=max \
  --push .

or in a folder:

kfg build --standalone -t app:1.0 \
  --cache-from type=local,src=.forge-cache \
  --cache-to type=local,dest=.forge-cache,mode=max .

A machine that has never built the project then skips every step it finds in the cache. ignore-error=true keeps a build going when the registry cache cannot be read, for example before the first build has written it.

Build for more than one platform

kfg build --standalone -t ghcr.io/you/app:1.0 \
  --platform linux/amd64,linux/arm64 --push .

The result is one image index holding both. An index cannot be loaded into Docker or written as a Docker tar, so send it with --push, -o type=oci,dest=app.tar or --oci-dir. RUN steps for a CPU other than the machine's own need an emulator: see Known issues.

Send the image somewhere else

Flag Result
(none) The image stays in Forge's store, or goes to the engine that ran the build.
--load Also load it into the Kiri or Docker engine on this machine.
--push Push it to the registry named by -t.
-o type=docker,dest=app.tar A file for docker load.
-o type=oci,dest=app.tar An OCI image layout in a tar.
-o type=local,dest=out/ The image's files, unpacked into a folder.

Secrets and SSH

kfg build --standalone --secret id=token,src="$HOME/.token" -t app .
kfg build --standalone --secret id=token,env=API_TOKEN -t app .
kfg build --standalone --ssh default -t app .

In the Dockerfile, a step asks for them with RUN --mount=type=secret,id=token ... or RUN --mount=type=ssh .... They are there for that step only and never end up in a layer.

The other flags

-f, --build-arg, --label, --target, --no-cache, --no-cache-filter, --pull, --network, --shm-size, --ulimit, --build-context, --iidfile and -q work as they do in docker buildx build. --progress is auto (the live view in a terminal, the plain log elsewhere), plain, tty or quiet, and NO_COLOR turns the colours off. kfg build --help lists them all.

Look after the store

kfg images             # the images you have built
kfg du                 # disk used by layers, caches and images
kfg prune              # remove what nothing uses any more
kfg prune -a           # also empty the build cache
kfg rmi hello:latest   # remove an image

The store is in /var/lib/kiri-forge for root and in ~/.local/share/kiri-forge for everyone else ($XDG_DATA_HOME/kiri-forge if that is set). KIRI_FORGE_STATE moves it. A build run with sudo and one run without it therefore use two different stores.

Inside Kiri

Requires Kiri 0.3.0 or later. From that version, kiri build uses Forge, and a build Forge cannot do yet goes to BuildKit with a line saying why. On older versions of Kiri, install kfg on its own as shown under Install.

kiri builder status                       # which builder kiri build uses
kiri builder use buildkit                 # switch; "use forge" switches back
kiri build --builder buildkit -t app .    # for one build only
kiri builder update                       # fetch the newest Kiri Forge

Kiri runs kiri-forge worker, a long-lived process that keeps the step cache and the last walk of your folder in memory between builds. Forge and Kiri are released separately, so the builder can be updated without updating Kiri.

In CI

A CI job pays the builder's overhead on every run: start a builder, hand it the files, pull the base images, check each step. Forge has no builder to start, pulls base images in parallel and skips every step it finds in a cache. How much that saves depends on the runner:

  • A runner that keeps its disk (your own machines): Forge's store is already there, so builds behave like the rebuild rows in the table. There is nothing to set up.
  • A runner that starts empty (hosted runners): keep the cache in your registry, or in a folder your CI restores, as shown above. Steps found in the cache are not run. With nothing cached at all, expect the last row of the table: about twice as fast as BuildKit.

There is a recipe below for GitHub Actions and for GitLab CI. On anything else the steps are the same: install the binary, log in to your registry, build with --standalone.

GitHub Actions

On GitHub Actions, one step installs Forge, checks the download and builds:

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

It is tested on GitHub's Linux runners, x86_64 and arm64. Log in to your registry in a step before it.

Without the action, the same thing as a plain workflow:

name: image
on:
  push:
    branches: [main]

permissions:
  contents: read
  packages: write

jobs:
  build:
    runs-on: ubuntu-24.04
    env:
      IMAGE: ghcr.io/${{ github.repository }}   # must be lower case
    steps:
      - uses: actions/checkout@v4

      - name: Install Kiri Forge
        run: |
          VERSION=0.1.3
          FILE="kiri-forge-$VERSION-linux-$(uname -m).tar.gz"
          curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$VERSION/$FILE"
          curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$VERSION/SHA256SUMS"
          sha256sum --check --ignore-missing SHA256SUMS
          tar -xzf "$FILE" kiri-forge
          sudo install -m 0755 kiri-forge /usr/local/bin/kiri-forge
          sudo ln -sf kiri-forge /usr/local/bin/kfg
          # Ubuntu stops ordinary users creating the namespaces the build sandbox needs.
          sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

      - name: Log in to the registry
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

      - name: Build and push
        run: |
          kfg build --standalone \
            -t "$IMAGE:${{ github.sha }}" \
            --cache-from type=registry,ref="$IMAGE:cache",ignore-error=true \
            --cache-to type=registry,ref="$IMAGE:cache",mode=max \
            --push .

GitLab CI

One job in .gitlab-ci.yml installs Forge, checks the download, logs in and builds. It pushes to your project's own container registry and keeps the build cache there too, so the next pipeline skips every step that has not changed:

build-image:
  image: debian:12-slim
  variables:
    FORGE_VERSION: "0.1.2"
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  before_script:
    - apt-get update -qq && apt-get install -y -qq curl ca-certificates
    - |
      # Install Kiri Forge. Download outside the project folder, so the
      # files stay out of the build.
      cd /tmp
      FILE="kiri-forge-$FORGE_VERSION-linux-$(uname -m).tar.gz"
      curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$FORGE_VERSION/$FILE"
      curl -fsSLO "https://github.com/libracoder/kiri-forge/releases/download/v$FORGE_VERSION/SHA256SUMS"
      sha256sum --check --ignore-missing SHA256SUMS
      tar -xzf "$FILE" -C /usr/local/bin kiri-forge
      ln -sf kiri-forge /usr/local/bin/kfg
      cd "$CI_PROJECT_DIR"
    - |
      # Log in. GitLab gives every job a login for the project's registry.
      mkdir -p ~/.docker
      printf '{"auths":{"%s":{"auth":"%s"}}}' "$CI_REGISTRY" \
        "$(printf '%s:%s' "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 -w0)" \
        > ~/.docker/config.json
  script:
    - |
      kfg build --standalone \
        -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" \
        --cache-from type=registry,ref="$CI_REGISTRY_IMAGE:cache",ignore-error=true \
        --cache-to type=registry,ref="$CI_REGISTRY_IMAGE:cache",mode=max \
        --push .

A GitLab job runs inside a container, and Forge needs that container to be allowed to create namespaces: it uses them to sandbox every RUN step.

  • GitLab.com's hosted Linux runners allow it already. The job above needs no changes.

  • Your own runner, Docker executor: a job container is locked down by default, and a RUN step stops with Linux namespace unshare failed. In the runner's config.toml, either set privileged = true, or grant only what Forge needs:

    [runners.docker]
      cap_add = ["SYS_ADMIN"]
      security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
  • Your own runner, shell executor: the job runs straight on the machine, so the notes under Where it runs apply and nothing else is needed. Forge's store stays on the machine between pipelines.

Why it is fast

flowchart LR
  A["Dockerfile and your files"] --> B["Plan, in a sealed process"]
  B --> C{"Each step"}
  C -->|"built before"| D["Take it from the step cache"]
  C -->|"COPY, ADD"| E["Hash only the files that changed, copy the rest from the old layer"]
  C -->|"RUN"| F["Mount the layers already unpacked, run in the sandbox"]
  D --> G["Image: store, registry or file"]
  E --> G
  F --> G
Loading
  • Nothing to start. There is no daemon to boot and no builder container to pull. Forge reads your folder where it is; nothing is packed up and sent to another process first.
  • It remembers the last look at your folder. Forge keeps the file sizes, times and checksums from the previous build on disk. On a rebuild it checks the known files in parallel, lists only the folders that changed and reads only the files that changed. This is most of the one-file and nothing-changed rows.
  • Layer splicing. Each COPY records where every file sits inside its layer. When one file changes, the unchanged files are copied straight out of the old layer, verified by checksum, and the new layer comes out byte for byte as if it had been built from scratch.
  • A step cache keyed on what a step really reads. A step is rebuilt only when its own inputs change. Instructions that only set image settings (ENV, ARG, LABEL, EXPOSE, USER, CMD) do not spoil the cache for later steps that never look at them, and two builds that need the same uncached step share one run of it.
  • Pulls in parallel, and only what is missing. The images named by FROM are looked up side by side and their layers come down four at a time, unpacked as they arrive. A layer already in the store is never fetched again. With a registry cache, only the layers of steps that match are downloaded. This is the last row of the table.
  • Layers kept ready to mount. The store keeps each layer unpacked, so a RUN step mounts its filesystem in place with nothing to extract first, and COPY --from reads another stage through the same kind of mount.
  • Stages side by side. Stages that do not depend on each other build at the same time. When a stage can start before the stage it copies from has finished, Forge runs that first part alongside it.
  • A worker that stays warm. Inside Kiri, one long-lived process keeps the step cache and the last folder walk in memory, so a build has no start-up work of its own.

What is in it

Forge is not a wrapper around BuildKit. Everything a Dockerfile build needs is in this one crate: 60,794 lines of Rust, with another 19,136 lines and 431 test functions testing it.

Part What it does
Dockerfile front end Parser, shell-word expander and all 22 lint checks, ported from BuildKit v0.33.1. All 18 instructions, heredocs, the # syntax, # escape and # check directives, and errors that point at the same line with the same message.
Planner Turns the Dockerfile into a graph of stages inside a sealed child process (seccomp on Linux, a sandbox profile on macOS) with hard limits on memory, time and size, so that a hostile Dockerfile cannot hurt the machine while it is being read.
COPY and ADD --from, --chown, --chmod, --exclude, --parents, --link, --checksum, --unpack, archives and URLs, with path handling that cannot be led outside the build folder by a symlink. The .dockerignore rules are ported from moby/patternmatcher.
RUN --mount of type bind, cache, tmpfs, secret and ssh, plus --network and --security.
Sandbox (Linux) Each RUN step gets its own mount, process, host-name and IPC namespaces, its own root filesystem on overlayfs, a short list of 14 capabilities and masked parts of /proc and /sys. It works as root or as an ordinary user.
Layer writer Writes tar archives exactly as Go's archive/tar does, which is what makes layer digests match BuildKit's.
Step cache Kept on disk, shared by concurrent builds, and tested by killing the process part-way through a write to show the store stays whole.
Registry client Pure Rust: TLS, token and basic logins, Docker credential helpers, parallel pulls, gzip and zstd, and push.
Cache import and export To and from a folder or a registry, or embedded in the image.
Outputs OCI layout, Docker tar, plain folder, registry, and multi-platform image indexes.
Store images, rmi, du and prune, with locks so that a prune can never remove a layer a running build is using.
Worker The socket protocol Kiri's engine speaks to Forge, passing open files rather than copying data.

The same image as BuildKit

Forge aims to give, byte for byte, what BuildKit v0.33.1 gives: the image config, the history, the layer tars and their whiteouts, the error messages with their source lines, and the lint warnings.

That is tested, not hoped for. The test data holds more than 5,000 answers recorded from BuildKit's own code for the parser, the instructions, shell-word expansion, the conversion to build steps, COPY, .dockerignore and folder walks, and Forge must give the same answer to each. A conformance suite of about 990 whole builds compares the finished images. Further tests throw hostile Dockerfiles at the planner and kill the step cache part-way through a write.

When a build asks for something Forge does not cover, Forge says so before it runs anything: on the command line it stops with the name of the feature, and inside Kiri the build goes to BuildKit.

Known issues and limits

Known issues in 0.1.3:

  • Ubuntu, as an ordinary user. Builds are refused until AppArmor allows user namespaces. See Where it runs.
  • macOS, --ssh in a standalone build. Forge cannot pass the SSH agent to a step that runs in a container engine, so the build stops with a sentence saying so. With Kiri running, build without --standalone and Kiri forwards the agent.

Where Forge does not yet do what BuildKit does:

  • Other frontends. Forge builds Dockerfiles with the built-in frontend only (# syntax=docker/dockerfile:1, up to 1.27.1). A # syntax= line or BUILDKIT_SYNTAX build arg naming any other frontend image is not run, and neither are docker buildx bake files.
  • Cache backends. --cache-from takes type=local and type=registry; --cache-to takes type=local, type=inline and type=registry. Others, such as type=gha and type=s3, are refused with unsupported --cache-from type or unsupported --cache-to type.
  • RUN for another CPU. Forge builds multi-platform images on any machine when the steps are only COPY and ADD. A RUN step for another CPU needs a Linux binfmt_misc emulator that is enabled and registered with the F (fix-binary) flag, as qemu-user-static installs it. Forge does not ship emulators.
  • RUN needs Linux. On macOS, Forge cannot run a RUN step by itself, because the sandbox is built on Linux namespaces. Kiri's engine, or a Docker engine, runs it.

Two things to expect:

  • Disk. The store keeps layers unpacked beside the layer files so that RUN steps mount at once. That costs extra disk until kfg prune.
  • Long steps. Forge removes the engine's overhead, not the work inside a step. A long compile or download in a RUN step that is not cached takes about as long as it does with BuildKit.

Use it as a library

kiri-forge = { git = "https://github.com/libracoder/kiri-forge", tag = "v0.1.3" }

Running steps, storing layers and finding base images plug in through three traits in ports (StepRunner, LayerStore, ImageSource). Kiri implements them on its engine, and the crate ships its own: LocalStore, RegistrySource and the Linux sandbox. It builds on Linux and macOS.

Tests

cargo test
cargo clippy --all-targets

The tests that compare Forge with BuildKit use recorded data kept in a separate repository that needs access to fetch. Without it they print SKIPPED: needs the builder test data and pass. With access, scripts/fetch-test-data.sh fetches the commit named in tests/test-data.pin into tests/data-cache/, taking the address from KIRI_TEST_DATA_URL or from tests/test-data.local (copy tests/test-data.local.example). The tests look in KIRI_TEST_DATA first, then in tests/data-cache/. KIRI_TEST_DATA_REQUIRED=1 makes missing data a failure.

Credits

Parts of the code are Rust translations of BuildKit, moby/patternmatcher, containerd and other projects, written so that builds give the same output. Each one and its licence is listed in NOTICE.

Licence

Apache-2.0 (LICENSE).

About

The modern image builder for containers. Builds your Dockerfiles up to 30× faster than BuildKit, as one binary with no daemon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

49 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages