Dockerized cross-compilation setup for:
- Source repo:
https://github.com/ultraworkers/claw-code - Targets: Linux, Windows, and macOS
- Build cache acceleration via bind-mounted Rust artifacts (
cache/andtarget-cache/)
docker/Dockerfile: build image with Rust + Zig +cargo-zigbuilddocker-compose.yml: one-shot build service with cache/artifact bind mountsscripts/build-all.sh: clones/updates source and builds all requested targets
From this repository root:
docker compose build claw-builder
docker compose run --rm claw-builderCompiled binaries are copied to:
artifacts/
x86_64-unknown-linux-gnu/
x86_64-pc-windows-gnu/
x86_64-apple-darwin/
The compose service bind mounts these host directories:
./cache/cargo-registryfor Cargo registry cache./cache/cargo-gitfor Cargo git cache./cache/rustupfor rustup toolchains/targets./target-cachefor Cargo target output
That means subsequent builds reuse downloaded crates and previously compiled artifacts.
Defined in docker-compose.yml and overridable per run:
REPO_URL(default: ultraworkers claw-code repo)REPO_BRANCH(default:master)REPO_DIR(default:/workspace/src/claw-code)ARTIFACTS_DIR(default:/workspace/artifacts)
Example override:
REPO_BRANCH=main docker compose run --rm claw-builder- Linux target is built with
cargo build; Windows and macOS targets are built withcargo zigbuild. - macOS cross-linking may emit SDK lookup warnings when Xcode SDKs are unavailable; in this workflow, builds still completed and produced binaries.
- First run is expected to be slower because dependencies and toolchains are downloaded.
If you run the built binaries against Ollama instead of Anthropic Claude, use these environment variables:
OPENAI_BASE_URL=htps://ollama.com/v1
ANTHROPIC_BASE_URL=http://localhost:11434
ANTHROPIC_API_KEY=ANTHROPIC_API_KEY is intentionally empty.
set "OPENAI_BASE_URL=htps://ollama.com/v1"
set "ANTHROPIC_BASE_URL=http://localhost:11434"
set "ANTHROPIC_API_KEY="
claw.exe@echo off
setlocal
set "OPENAI_BASE_URL=htps://ollama.com/v1"
set "ANTHROPIC_BASE_URL=http://localhost:11434"
set "ANTHROPIC_API_KEY="
claw.exe
endlocal$env:OPENAI_BASE_URL = "htps://ollama.com/v1"
$env:ANTHROPIC_BASE_URL = "http://localhost:11434"
$env:ANTHROPIC_API_KEY = ""
./claw.exeThese commands avoid setting permanent user-level variables.