Files
clawmates/images/server.Dockerfile
T
Omar SobhandClaude Opus 4.7 9ba5c06a1a
ci / gates (push) Successful in 6s
ci / rust (push) Failing after 11s
ci / frontend (push) Successful in 28s
ci / e2e (push) Skipped
ci / publish (push) Skipped
slice 3: 6 team templates seeded from TOML recipes
Team templates are the canonical rosters + tool bundles that mint
concrete teams for a mission. Every builtin ships as a TOML recipe
under templates/teams/*.toml, loaded into the DB at server boot.

Migration 0048 adds:
  - team_templates    (id, key, name, stack, default_topology,
                       risk_profile, mcp_bundles, version, source,
                       workspace_id)
  - template_roles    (m2m: template_id + slot; system_prompt,
                       skills[], brain_seed)
  - teams gets template_id + template_version for level-up lineage

Ships 6 builtins:
  - rust_sdlc  — planner/coder/tester/reviewer/committer for Rust
  - backend    — api_designer/db_engineer/coder/tester/committer
                 (Postgres, DuckDB, graph DBs, wire protocols)
  - frontend   — designer/coder/tester/committer (React + Tailwind + ShadCN)
  - mobile     — designer/coder/tester/committer (Expo, RN, iOS, Android)
  - gpu        — arch_analyst/kernel_author/bench_engineer/coder/committer
                 (CUDA, Metal, ROCm from Rust)
  - threejs    — scene_designer/coder/shader_author/perf_engineer/
                 committer (three.js, WebGL, WebGPU)

Each role has a versioned system_prompt + skill list + brain_seed
markdown. Skills column is a name array today; Slice 3.5a promotes it
to a typed m2m join with the real skills catalog.

Server boot:
  - team_template_loader::load_builtins reads TOML from
    /etc/clawmates/templates/teams (container) or templates/teams (dev),
    upserts idempotently. Deterministic uuid per template key (sha256
    of a fixed namespace + key) so ids are stable across boots.
  - Dockerfile copies templates/ to /etc/clawmates/templates.

Read API:
  - GET /api/team-templates       — list all
  - GET /api/team-templates/{id}  — detail with roles

Wizard:
  - Step 3 rewired from a raw team_id text field to a template picker
    with "LLM auto-provision" as the default option + one card per
    builtin, showing stack, topology, risk profile, and description.
  - Mission create now passes team_template_id (not team_id) so phase
    execution knows which template to mint from.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-07-19 12:41:15 -07:00

51 lines
2.4 KiB
Docker

# clawmates-server: static musl build into distroless. The same image serves
# the air-gapped bundle and the cloud registry.
FROM rust:1.96-slim AS builder
ARG TARGETARCH
# git + cmake are needed for the clawhdf5 git dependency (fetched via the git
# CLI — libgit2 chokes on Gitea smart-HTTP) and its zlib-ng C build (cmake).
RUN apt-get update \
&& apt-get install -y --no-install-recommends musl-tools git cmake make pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY crates ./crates
COPY tools ./tools
COPY images/seccomp ./images/seccomp
COPY migrations ./migrations
COPY .sqlx ./.sqlx
# Install the musl target AFTER rust-toolchain.toml is in place, so rustup adds
# it to the toolchain the workspace pins (channel 1.96.0), not the base image's
# default. Doing this before the COPY installs into a toolchain cargo won't
# actually use, and the build then fails with E0463 (no core for musl).
RUN case "$TARGETARCH" in \
arm64) echo aarch64-unknown-linux-musl > /rust-target ;; \
*) echo x86_64-unknown-linux-musl > /rust-target ;; \
esac \
&& rustup target add "$(cat /rust-target)"
ENV SQLX_OFFLINE=true
# Fetch git deps with the system git (libgit2 fails against Gitea smart-HTTP);
# build the zlib-ng C dep with the musl cross compiler for the static target.
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true \
CC_x86_64_unknown_linux_musl=musl-gcc \
CC_aarch64_unknown_linux_musl=musl-gcc
RUN cargo build --release --target "$(cat /rust-target)" -p clawmates-server \
&& cp "target/$(cat /rust-target)/release/clawmates-server" /clawmates-server
FROM debian:12-slim
# git — required at runtime for research topic repo clones
# (routes/research_setup::ensure_repo_workspace shells out to `git clone`
# and `git ls-files`). The distroless variant we had here didn't include
# a git binary; every wizard-materialized research topic silently failed
# to clone until this change.
# ca-certificates — required by `git clone` over HTTPS.
RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -u 65532 -M -s /usr/sbin/nologin nonroot
COPY --from=builder /clawmates-server /usr/local/bin/clawmates-server
# Builtin templates (team + workflow). Loader upserts them on boot.
COPY templates /etc/clawmates/templates
USER 65532
ENTRYPOINT ["/usr/local/bin/clawmates-server"]