Docker and Build Pipeline
This page documents the open source distribution build pipeline.
Packaging
The 404 distribution is built as a minimal Linux root filesystem and exported as a flat root filesystem tarball that Windows can import through WSL.
Use docker export, not docker save
WSL expects an importable root filesystem tarball.
docker exportgives you that.docker savegives you an image archive, which is the wrong artifact forwsl --import.
Dependencies
docker- a Linux or Linux-capable build environment for the musl binary and eBPF object
src/STATIC_proxy/target/x86_64-unknown-linux-musl/release/static_proxysrc/ebpf/ttl_editor.o
The STATIC binary must be musl-targeted. A glibc-targeted Linux build is the wrong input for the minimal distribution rootfs.
Build the JavaScript bundle dependencies
Build the musl STATIC binary
rustup target add x86_64-unknown-linux-musl
CC_x86_64_unknown_linux_musl=musl-gcc \
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
cargo build --release --locked \
--manifest-path src/STATIC_proxy/Cargo.toml \
--bin static_proxy \
--target x86_64-unknown-linux-musl
Build the eBPF object
That Makefile currently checks for:
clangllvm-striptclibbpfheaders- kernel BPF headers
build.sh
./distro/build.sh:
- Stages the rootfs files
- Copies the musl STATIC binary into the build context
- Copies
ttl_editor.ointo the build context - Writes
/opt/404/distro-version - Builds the temporary Docker image
- Creates a container from that image
- Exports the filesystem and gzips it into
dist/404-distro.tar.gz
Usage:
./distro/build.sh \
--static-binary "$PWD/src/STATIC_proxy/target/x86_64-unknown-linux-musl/release/static_proxy" \
--ttl-object "$PWD/src/ebpf/ttl_editor.o" \
--version v0.1.0-dev \
--output "$PWD/dist/404-distro.tar.gz" \
--image-tag "404-distro-build:local"
Inspect the resulting tarball
After packaging:
Make sure you see the following files:
opt/404/staticopt/404/ttl_editor.oopt/404/404-init.shopt/404/distro-versionetc/wsl.conf
Manual Docker export path
build.sh responsibilities:
- stage
rootfs/plus the built artifacts into a temporary Docker build context docker buildthat contextdocker createa container from the imagedocker exportthat container- gzip the export stream
Expected output
The output must be a flat root filesystem tarball, not a Docker image archive.
CI shape
The tagged distro release path automates this process:
- Builds the musl STATIC binary
- Build the eBPF object
- Package the distro tarball
- Generate the stable manifest
- Sign the manifest with
DISTRO_MANIFEST_SIGNING_KEY - Publish stable and versioned objects to the public update origin
The tagged release workflow publishes:
- Stable
distro/manifest.json - Stable
distro/manifest.json.sig - Versioned
distro/<tag>/404-distro.tar.gz - Versioned
distro/<tag>/manifest.json - Versioned
distro/<tag>/manifest.json.sig