feat(bottles): implement bottle factory abstraction per PRD 0003
test / run tests/run_tests.py (pull_request) Successful in 16s
test / run tests/run_tests.py (pull_request) Successful in 16s
Introduce claude_bottle/bottles/ with a Bottle Protocol and a get_bottle_factory() that dispatches on CLAUDE_BOTTLE_PLATFORM (default "docker"). Move every Docker-specific subprocess.run call from cli/start.py, plus the orchestration of build, networks, the pipelock sidecar, container launch, and per-container provisioning (prompt, skills, ssh, .git), into create_docker_bottle. Drop bottles[].runtime from the manifest schema. Auto-detect whether gVisor is registered with the daemon and pass --runtime=runsc when it is; the preflight shows the resolved runtime so the choice is visible. Manifests still carrying 'runtime' get a clear error pointing at the auto-detect behavior, rather than silent ignore. Out of scope: cli/cleanup.py and cli/list.py still call docker directly. They enumerate active bottles across the host, which is a separate concern from "create a bottle" and is left for a follow-up that introduces a list_active/cleanup primitive on the factory.
This commit is contained in:
@@ -19,22 +19,6 @@ def require_docker() -> None:
|
||||
die("docker not found")
|
||||
|
||||
|
||||
def require_runsc() -> None:
|
||||
"""Fail with an install pointer if the `runsc` (gVisor) runtime is
|
||||
not registered with the local Docker daemon. Called when a bottle
|
||||
sets `runtime: "runsc"`."""
|
||||
result = subprocess.run(
|
||||
["docker", "info", "--format", "{{json .Runtimes}}"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode != 0 or "runsc" not in result.stdout:
|
||||
info("This bottle requested runtime 'runsc' but the gVisor runtime is not registered with Docker.")
|
||||
info("Install gVisor and register it with the daemon: https://gvisor.dev/docs/user_guide/install/")
|
||||
info("On macOS, gVisor is not available natively; remove 'runtime' from the bottle or run on Linux.")
|
||||
die("runsc runtime not available")
|
||||
|
||||
|
||||
def image_exists(ref: str) -> bool:
|
||||
return _silent_run(["docker", "image", "inspect", ref]) == 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user