Skip to content

refactor: build runtime images with Bake under image/ - #13507

Merged
cv merged 2 commits into
v1from
refactor/runtime-images-bake
Oct 20, 2026
Merged

cv merged 2 commits into
v1from
refactor/runtime-images-bake

Conversation

@cv

@cv cv commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Failure

NemoClaw built its images two ways. Agent and proxy images used docker buildx bake (docker-bake.hcl). The vLLM and Ollama runtime images, under runtimes/, used a separate runtime builder in nemoclaw-build: cargo run -p nemoclaw-build -- runtime runtimes/<name>/build.json, about 780 lines plus a build.json per runtime and its own tests. That builder staged and vendored the supervisor's sources, compiled the supervisor on the host, downloaded licenses by checksum, wrote supervisor.json, exported an OCI archive, loaded it, and checked its digest.

Decision

One build path, and the images in one place.

  • Layout: runtimes/vllm and runtimes/ollama become image/vllm and image/ollama, beside image/fabric and image/ollama-proxy.

  • image/supervisor/Dockerfile (on pinned rust:1.99.1-bookworm):

    • packages the runtime crate with cargo package;
    • vendors its locked dependency sources;
    • archives them with fixed timestamps;
    • compiles the supervisor --offline from that archive.

    Bookworm's glibc 2.36 is older than both bases' 2.39, so the supervisor stays dynamically linked as before.

  • The vLLM and Ollama Dockerfiles stay thin: each copies the supervisor and its source archive from the shared stage and keeps its notice, its Dockerfile, and the supervisor's Dockerfile under /opt/nemoclaw/source/. The Ollama license comes in by ADD --checksum.

  • docker-bake.hcl gains supervisor, vllm, ollama and the runtimes group:

    • runtime targets always build for the host's platform (BAKE_LOCAL_PLATFORM), so the supervisor never compiles under emulation;
    • provenance is disabled and timestamps are rewritten, so the same sources give the same digest;
    • Docker's containerd store can't unpack while rewriting timestamps, so the output sets unpack=false; Docker unpacks on first run.
  • Small behavior change: AGENT_PLATFORM now defaults to the host's platform instead of being required, still validated to linux/arm64 or linux/amd64. cargo images build and CI keep passing it explicitly.

  • Removed from nemoclaw-build:

    • the runtime builder, its runtime command, source_archive, and its dependency on nemoclaw-runtime;
    • the builder's tests, and their two names in the live-docker filter.

    The test that the CI builder doesn't pull in the SDK moves to builder_dependencies.rs.

  • Dropped: supervisor.json and the runtime-only source version. Nothing read them; the retained archive is the source record, and the runtime contract stays checked through nemoclaw_runtime::SPEC_VERSION and the image labels.

  • CI path rules: runtime image directories keep out of CI / Images, as runtimes/ did, and still trigger the live, bundle and lifecycle checks through image/**.

  • Docs and examples use docker buildx bake vllm or ollama and docker image inspect for the digest.

Validation

  • Checks: cargo ci passed, including the bundle and lifecycle steps, after rebasing onto refactor: remove the Qwen3.8 recipe image #13506. fern check reported 0 errors.
  • New bake tests:
    • runtime targets plan only for the host, with the supervisor context and rewritten timestamps;
    • agent targets default to the host and reject other platforms.
  • On a DGX Spark (linux/arm64):
    • docker buildx bake runtimes built both images. The vLLM image keeps its four NemoClaw labels, and both supervisors run.
    • The retained archive holds the runtime package with its notice, a Cargo.lock with no SDK, provider, OpenShell, Fabric, Bollard or Tonic packages, the vendored sources (about 19,700 entries), and the vendoring config.
    • Rebuilding Ollama with --no-cache produced the same digest (sha256:6d776313…).
    • cargo ci live-docker passed (9 tests: the previous 11 minus the two builder tests).
    • The managed Hermes example with the new Ollama image applied, and Hermes ran uname -m and replied aarch64. The deployment was destroyed and its objects removed.
  • Not run: live vLLM serving and an AMD64 build.

Move runtimes/vllm and runtimes/ollama to image/, beside the agent and proxy images, and build them with docker buildx bake instead of nemoclaw-build's runtime builder. A shared supervisor stage packages the runtime crate, vendors its locked dependencies, and compiles it offline; the vLLM and Ollama images retain that archive and their notices. Runtime images always build for the host's platform with fixed timestamps; agent images now default to the host's platform.
@cv
cv enabled auto-merge (squash) October 20, 2026 01:41
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 0bc2601 into v1 Oct 20, 2026
@cv
cv deleted the refactor/runtime-images-bake branch October 20, 2026 02:36
gaveezy added a commit that referenced this pull request Oct 20, 2026
v1 moved the runtime images under image/ and builds them with Bake
(#13507), deleting runtimes/vllm/Dockerfile and runtimes/ollama/Dockerfile.
This branch had added the `nemoclaw-runtime-ready` symlink to both, so
the merge takes the deletions and adds the same `RUN ln -s` line to
image/vllm/Dockerfile and image/ollama/Dockerfile, right after the
supervisor binary is copied. The contract test that checks the readiness
command against the runtime images now reads them from image/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gaveezy added a commit that referenced this pull request Oct 20, 2026
…ices

The base branch merged v1 up to 0bc2601. Resolutions:

- SecretRef/FileRef split (#13222): `credential` on an inference
  provider is now a `SecretRef`. The cluster key keeps its description
  (the same key as the service's `kubernetes.keySecret`), and
  `InferenceTarget::Service` carries `Option<&SecretRef>`. The authored
  form, `credential: {env: …}`, is unchanged, so the examples and
  fixtures stay as they are.
- context_advisory.rs was removed (#13485). This branch had only
  widened its `InferenceTarget::Service` pattern, so the merge takes the
  deletion and drops the call in `Deployment::run`, keeping the
  NetworkPolicy warning before it.
- Runtime images now build with Bake under image/ (#13507), which
  removed nemoclaw-build's runtime_source.rs and tests/runtime_engine.rs.
  The merge takes both deletions. That also removes 05fb557's
  `--offline` packaging and its test: on Live/Docker runners, archived
  tests ran with a Cargo home that lacked the OpenShell git checkout, so
  offline packaging failed ("you are in the offline mode").
- The authoring journey count is 41: v1 removed one single-sandbox
  example and this branch adds two.
- The schema and configuration reference are regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cv added a commit that referenced this pull request Oct 20, 2026
## Failure

`cargo images build` built each agent image twice. It baked the image
under a temporary tag, ran `catalog.py --installed` in a container to
read the installed Fabric catalog, then ran a second `docker build FROM`
the temporary image to add the `io.nemoclaw.fabric.catalog` label that
plan reads. So the image Bake built was never the image deployments
used, and `docker buildx bake --push` would publish unlabeled images,
which blocks publishing images from Bake to a registry.

The label exists because plan reads the catalog from the image
configuration: locally through Docker, and on Kubernetes from the
exported metadata bundle, without pulling layers. Derived images inherit
it through `FROM`. A Dockerfile can't set a label from something its own
build computes, hence the relabel.

## Decision

Compute the label inside the same Dockerfile and pass it between two
cached Bake builds.

- **`image/fabric/Dockerfile`** gains two stages, built on the harness
stage that a global `STAGE` argument selects:
- `catalog` runs `catalog.py --installed` offline and exports
`/catalog.json`;
- `labeled` takes it as the `CATALOG` build argument, sets the label,
and fails the build unless `CATALOG` matches the installed catalog. A
missing or wrong catalog fails with "CATALOG must be this image's
installed catalog; build with cargo images build".
- **`docker-bake.hcl`** passes `STAGE` for each agent and for the
reference image.
- **`cargo images build`:**
  - bakes `<name>` with `target=catalog` to `.build/catalog/<name>`;
- applies its existing label checks (only the reference image lists the
reference adapter);
  - bakes `<name>` with `target=labeled` and the catalog.
  
The temporary tag, the metadata container, the relabel build, and
`read_metadata` are gone. Tags come from Bake as for every other image.
- **Unchanged:** a plain `docker buildx bake <agent>` still builds the
unlabeled harness stage, so the Brev candidate build is unaffected.
- **Also fixed:** an unused-function warning in the CI runner build,
left by #13507. `target` is used only by the bundle, so it is gated on
the `sdk` feature.

## Validation

- **Prototype, on a DGX Spark (linux/arm64):**
- the `catalog` and `labeled` builds of the reference image each took
about 1 s from cache, and the label equaled the exported catalog;
- a wrong or missing `CATALOG` failed the build with the message above;
  - a plain bake build stayed unlabeled.
- **Real builds:** `cargo images build --platform linux/arm64 agents`
built all ten images with labels in 227 s.
- **Qualification:** CI's loop passed for every image (`cargo images
qualify`, with the OpenClaw, Hermes and Pi lifecycles, plus
`image/test_image.py` against each label), and `cargo images qualify
nc-fabric:dummy --lifecycle dummy` passed.
- **Checks:**
- `docker buildx bake --check dummy agents ollama-proxy` and `docker
buildx bake check` passed;
  - `cargo ci` passed, including the bundle and lifecycle steps;
- `cargo ci live-docker` passed (9 tests), building its Pi and reference
images through this path and deploying them.
- **Tests:** the live image test now expects each agent's catalog bake
and labeled bake. The Docker fake writes the exported catalog.
@wscurran wscurran added area: packaging Packages, images, registries, installers, or distribution area: providers Inference provider integrations and provider behavior chore Build, CI, dependency, or tooling maintenance platform: container Affects Docker, containerd, Podman, or images provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior v1 NemoClaw v1 branch labels Oct 23, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: packaging Packages, images, registries, installers, or distribution area: providers Inference provider integrations and provider behavior chore Build, CI, dependency, or tooling maintenance platform: container Affects Docker, containerd, Podman, or images provider: ollama Ollama local model provider behavior provider: vllm vLLM local or hosted provider behavior v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants