Skip to content

Dockerfile + docker-compose.yml: rewrite for Rust stack lift #2

Description

@moonexpr

The current Dockerfile and docker-compose.yml build the legacy Python/FastAPI backend. The Phase-A backend rewrite (Python → Rust/axum) and the subsequent stack lift (app/ tree: Tauri + Rust sidecar + Vite/React 19 + Tailwind 4 + CodeMirror 6 + AI SDK v6 — branch lift/tauri-portable-pty-cm6-aisdk) leave the container path completely out of date.

This is a follow-up to the lift PR — the lift itself does not change Docker artifacts (the legacy backend/ + frontend/ trees still build from main until the cleanup PR).

Current state (broken / obsolete)

Dockerfile

# Final Stage for Backend and Frontend Assets
FROM python:3.11-slim
WORKDIR /app
...
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ ./backend/
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
ENV PYTHONPATH=/app/backend
ENV PORT=8000
EXPOSE 8000
CMD [\"python\", \"-m\", \"uvicorn\", \"app.main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]
  • Python runtime + uvicorn entry — no longer applicable (current backend/ is Rust).
  • backend/requirements.txt is gone.
  • No app/ stage at all (lift binaries server-core + server-bin are unbuildable here).

docker-compose.yml

environment:
  - DATABASE_URL=sqlite+aiosqlite:///./data/claude_registry.db
  • sqlite+aiosqlite:// is the Python async dialect; sqlx accepts sqlite:// (or no prefix and a plain path).

Expected rewrite

Multi-stage build, two paths to choose:

Option A — ship the current legacy Rust backend (faster, no lift dependency)

  1. FROM rust:1.85-slim AS backend-builder — build the current Rust backend/ crate with cargo build --release.
  2. FROM node:20-slim AS frontend-builder — build frontend/ (existing).
  3. FROM debian:bookworm-slim final stage — copy the binary + frontend/dist, set FRONTEND_DIST=/app/frontend/dist, EXPOSE 8000, CMD [\"./backend-bin\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"].

Pros: minimal scope, ships what's on main today.

Option B — ship the app/ lift stack (post-cutover)

  1. FROM rust:1.85-slim AS server-buildercd app/server && cargo build --release -p server-bin.
  2. FROM node:20-slim AS web-buildercd app/web && npm ci && npm run build.
  3. FROM debian:bookworm-slim final stage — copy server-bin + app/web/dist, set FRONTEND_DIST=/app/web/dist, EXPOSE 8000, CMD [\"./server-bin\"].
  4. Optional: do not ship the Tauri desktop in the container — desktop is local-install only.

Pros: aligns the container with the lift target.

The cleanup PR (which renames backend/+frontend/legacy/) is the natural moment to commit to Option B.

docker-compose.yml updates

  • DATABASE_URL=sqlite:///app/data/claude_registry.db (or omit — server-bin defaults to a local DB).
  • Mount app/server/claude_registry.db location into the data volume.
  • Optionally pass ANTHROPIC_API_KEY env so the in-container build supports the chat panel.

Repo locations

  • Dockerfile (repo root)
  • docker-compose.yml (repo root)
  • app/server/ (lift Rust workspace) · app/server/bin/src/main.rs (server-bin entry)
  • app/web/ (lift Vite/React) · app/web/dist/ (build output)
  • backend/ (legacy Rust binary still on main)
  • frontend/ (legacy Vite/React still on main)

Acceptance criteria

  • docker compose up builds and starts the container without error.
  • The UI is reachable at http://localhost:8000 and renders correctly.
  • /api/v1/status returns 200 with version info.
  • CC Bridge can spawn a child PTY inside the container (or the limitation is documented if Option B and portable-pty inside Docker is awkward).
  • ANTHROPIC_API_KEY env is honored — chat panel works when the var is set.
  • Image size is reasonable for a Rust binary + static dist (≲ 200 MB).

Where to look first

  • Cargo workspace root: app/server/Cargo.toml
  • Server-bin entry: app/server/bin/src/main.rs (reads HOST, PORT, DATABASE_URL, PRESENCE_PUBLIC_URL, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, FRONTEND_DIST).
  • Web build: app/web/package.json (npm run buildapp/web/dist/).

Context

Discovered during the Phase-D build/cutover pass of the stack lift, session 2026-05-23 (branch lift/tauri-portable-pty-cm6-aisdk). Out of scope for the lift PR per the canonical plan ("Dockerfile fix-or-file: Only blocking if container deploy is in scope at PR time"). Filed so the rewrite is not lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions