Skip to content

Commit f264e33

Browse files
docs(ci): document Linux Docker build, runner policy, and caching
- Rewrite Docker Builds section for cargo-chef multi-stage Dockerfile with stage table (deps, planner, cook, check, build, artifacts) - Document Blacksmith Docker layer caching for CI usage - Add CI Runner Policy section with per-job runner assignments, Linux toggle, macOS broadening, and vanilla runner policy - Update build-linux-amd64 CI/CD section for containerized flow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dce5b5a commit f264e33

1 file changed

Lines changed: 65 additions & 15 deletions

File tree

docs/builds.md

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,50 @@ task tauri:build
399399

400400
### Docker Builds (Linux .deb)
401401

402-
Linux amd64 packages can be built locally via Docker, which is useful for producing `.deb` packages from a macOS development machine.
403-
404-
| Architecture | Task | Dockerfile | Notes |
405-
| ------------- | ------ | ------------ | ------- |
406-
| amd64 | `task build:linux-amd64` | `docker/Dockerfile.linux-amd64` | QEMU emulation on Apple Silicon |
402+
Linux amd64 builds use a multi-stage Dockerfile (`docker/Dockerfile.linux-amd64`) for both CI and local builds. The Dockerfile uses [cargo-chef](https://github.com/LukeMathWalker/cargo-chef) to cache compiled dependencies separately from application code.
403+
404+
**Stages:**
405+
406+
| Stage | Purpose | Target |
407+
| --------- | --------- | -------- |
408+
| `deps` | System packages, Rust nightly, Node.js, cargo-chef, tauri-cli | (base) |
409+
| `planner` | `cargo chef prepare` — generates recipe.json from manifests | (internal) |
410+
| `cook` | `cargo chef cook` — compiles all dependencies (cached layer) | (internal) |
411+
| `check` | `cargo check --workspace` | `--target check` (test workflow) |
412+
| `build` | `cargo tauri build` + `cargo tauri bundle` | (internal) |
413+
| `artifacts` | Extract `.deb` and binary | `--target artifacts` (release workflow) |
414+
415+
**CI usage:**
416+
417+
In CI, [Blacksmith Docker layer caching](https://docs.blacksmith.sh/blacksmith-caching/docker-builds) persists all layers on NVMe-backed sticky disks. After the first run, the `deps` and `cook` layers are cached — subsequent runs only rebuild changed source code.
418+
419+
```yaml
420+
# test.yml — cargo check only
421+
- uses: useblacksmith/setup-docker-builder@v1
422+
- uses: useblacksmith/build-push-action@v2
423+
with:
424+
target: check
425+
426+
# release.yml — full build + bundle, extract artifacts
427+
- uses: useblacksmith/setup-docker-builder@v1
428+
- uses: useblacksmith/build-push-action@v2
429+
with:
430+
target: artifacts
431+
outputs: type=local,dest=dist
432+
```
407433
408-
Artifacts are written to `dist/linux-amd64/`.
434+
**Local usage:**
409435
410436
```bash
411-
# Build amd64 .deb
437+
# Build .deb via task (QEMU emulation on Apple Silicon)
412438
task build:linux-amd64
413439

414-
# Copy to target machine
415-
scp dist/linux-amd64/*.deb zima:~/Downloads/
440+
# Or build directly with Docker
441+
docker build --platform linux/amd64 --target check -f docker/Dockerfile.linux-amd64 .
442+
docker build --platform linux/amd64 --target artifacts --output type=local,dest=dist -f docker/Dockerfile.linux-amd64 .
416443

417-
# Debug shell (inspect build environment)
418-
task build:linux-amd64:shell
444+
# Copy to target machine
445+
scp dist/*.deb zima:~/Downloads/
419446
```
420447

421448
### Windows (NSIS)
@@ -512,11 +539,14 @@ Runs on a self-hosted `[macOS, ARM64]` runner:
512539

513540
### `build-linux-amd64` — Linux amd64
514541

515-
Runs on a configurable Blacksmith runner (default: `blacksmith-4vcpu-ubuntu-2404`, selectable via `linux-runner` workflow input):
542+
Runs on a configurable Blacksmith runner (default: `blacksmith-4vcpu-ubuntu-2404`, selectable via `linux-runner` workflow input). Uses a containerized build via `docker/Dockerfile.linux-amd64` with Blacksmith Docker layer caching:
543+
544+
1. Sets up the Blacksmith Docker builder (`useblacksmith/setup-docker-builder`)
545+
2. Builds via `useblacksmith/build-push-action` targeting the `artifacts` stage
546+
3. Extracts `.deb` and binary from the container to `dist/`
547+
4. Attaches the `.deb` to the same draft GitHub Release
516548

517-
1. Sets up the Tauri build environment via the shared composite action
518-
2. Builds with `tauri-action` targeting `x86_64-unknown-linux-gnu --bundles deb`
519-
3. Attaches the `.deb` to the same draft GitHub Release
549+
The test workflow (`test.yml`) uses the same Dockerfile but targets the `check` stage (`cargo check` only).
520550

521551
### `build-windows` — Windows x64
522552

@@ -531,6 +561,26 @@ Runs on a self-hosted `[self-hosted, Windows, X64]` runner:
531561
7. Attaches the signed `.exe` to the same draft GitHub Release
532562
8. Cleans up the certificate and config override (runs in `always()` step)
533563

564+
### CI Runner Policy
565+
566+
Runner assignment is optimized for developer iteration speed (PR/push), not release throughput.
567+
568+
| Job | Runner | Rationale |
569+
| ------ | -------- | ----------- |
570+
| `rust` (lint/test) | `[macOS, ARM64]` | Self-hosted, no queue contention |
571+
| `build(macos)` | `[macOS, ARM64]` | Eligible on all ARM64 self-hosted runners |
572+
| `build(linux)` | Blacksmith (configurable) | Containerized via Docker, deps cached by Blacksmith sticky disks |
573+
| `build(windows)` | `[self-hosted, Windows, X64]` | Self-hosted, registry-only cargo cache |
574+
| `deno-lint` | `blacksmith-4vcpu-ubuntu-2404` | Lightweight, vanilla runner |
575+
| `vitest-tests` | `blacksmith-4vcpu-ubuntu-2404` | Lightweight, vanilla runner |
576+
| `playwright-tests` | `[macOS, ARM64]` | Needs WebKit, self-hosted |
577+
578+
**Linux runner toggle:** Both `test.yml` and `release.yml` accept a `linux-runner` workflow_dispatch input. Default is `blacksmith-4vcpu-ubuntu-2404`. To test a different runner label, trigger manually and select from the dropdown. No file edits required for rollback.
579+
580+
**macOS runner broadening:** macOS jobs use `[macOS, ARM64]` (no `studio` pin) so they can schedule on any eligible self-hosted ARM64 runner.
581+
582+
**Lightweight jobs stay on vanilla runners:** `deno-lint` and `vitest-tests` remain on standard Blacksmith runners. Migration to custom images is deferred until a measured benefit is demonstrated.
583+
534584
#### Windows Toolchain Pinning
535585

536586
The self-hosted Windows runner can accumulate stale rustup state across runs. In particular, a system-level settings file (`C:\Windows\system32\config\systemprofile\.rustup\settings.toml`) may set `default_host_triple` to `x86_64-pc-windows-gnu`. When `RUSTUP_TOOLCHAIN` is set to a bare channel name like `nightly-2026-02-09`, rustup resolves it using the default host triple — producing the GNU-hosted toolchain, which requires `dlltool.exe` (not present on MSVC-only runners) and fails with:

0 commit comments

Comments
 (0)