Files
container/Sources/NativeBuilder
Kathryn Baldauf 16f2630126 Add initial native builder code (#399)
We're working on making a pure swift container image build system that
leverages containerization. This PR represents our initial design and
initial work towards this goal.

The native builder is still in active development and most of the
implementation has not been started or completed. We will be opening a
series of issues that represent various (but not necessarily all) pieces
of work that need to be done here.

There are docs included in this PR that describe the overall design of
each component and outline some of our goals. The easiest way to view
the docs by themselves (since this is a massive PR) is to look at the
docs commit in the `Commits` tab.

We'd love any feedback! 

@wlan0

---------

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2025-07-31 13:13:20 -07:00
..

Swift Native Builder

A pure-Swift container build system leveraging Containerization.framework for fast, secure, and reproducible builds.

Overview

Swift Native Builder is a modern container build system that replaces traditional container builders with a Swift-native implementation. It runs each build step in isolated VMs, uses content-addressable storage for caching, and produces OCI-compliant container images.

Key Features

  • Headless - No daemon required, runs as a simple CLI tool
  • Mac-Native - Built on Containerization.framework and Swift Concurrency
  • Secure - Hardware-backed signing with Secure Enclave, biometric-protected secrets
  • Fast - Parallel execution with intelligent caching

Quick Start

# Build a container image
swift run builder build .

# Build with secrets
swift run builder secret add github-token --biometric
swift run builder build --build-secret=id=github-token,target=/run/secrets/token .

Architecture

The project consists of several components:

  • ContainerBuildIR - Intermediate representation for build operations
  • Parser - Dockerfile parser and build graph generator
  • Scheduler - DAG scheduler for parallel execution
  • Executor - VM-based execution engine
  • CAS - Content-addressable storage for layers

Development

# Build the project
swift build

# Run tests
swift test

# Run demo
swift run container-build-demo

Status

This project is under active development. The IR layer is implemented and functional.