Skip to content

feat: unified Docker workspace mount with supervised daemon#135

Merged
georgeh0 merged 2 commits intomainfrom
g/docker-unified-workspace
Apr 14, 2026
Merged

feat: unified Docker workspace mount with supervised daemon#135
georgeh0 merged 2 commits intomainfrom
g/docker-unified-workspace

Conversation

@georgeh0
Copy link
Copy Markdown
Member

Closes #128.

Summary

  • Reshape the Docker experience around a single bind mount + single named volume. Global settings live on the host at $HOME/.cocoindex_code/global_settings.yml (visible, editable, no docker exec cat dance). Index databases and the pre-baked model cache share one cocoindex-data volume; daemon runtime state (daemon.sock/daemon.pid/daemon.log) stays on the container's native FS.
  • Introduce a bidirectional host/container path translator (COCOINDEX_CODE_HOST_PATH_MAPPING) and a host-pwd forwarding env var (COCOINDEX_CODE_HOST_CWD) so CLI output and MCP results show host-side paths and cd+ccc works from any project under the mounted workspace.
  • Make settings-change restart safe in Docker: the daemon tolerates a missing global_settings.yml (starts in "no-settings" mode), the entrypoint runs a restart loop with signal forwarding, and the client branches on a new COCOINDEX_CODE_DAEMON_SUPERVISED env var — stop_daemon() then wait, no start_daemon() race. Non-Docker behavior unchanged.
  • Add PUID/PGID entrypoint pattern with gosu so files written to the bind mount on Linux are owned by the host user, not root. docker/docker-compose.yml wires this as a one-command quickstart.
  • CI release workflow now publishes the image to both Docker Hub (primary, cocoindex/cocoindex-code) and GHCR (mirror, ghcr.io/cocoindex-io/cocoindex-code). GHCR swap is documented as a one-line README change.

Test plan

  • uv run mypy . — no issues in 35 source files
  • uv run pytest tests/ — 147 passed, 8 deselected by docker_e2e marker
  • uv run pytest -m docker_e2e — 6 passed, 2 Linux-only PUID tests skipped on macOS (covers index+search, host-cwd forwarding valid/invalid, baked-model-no-redownload, settings-change supervised restart, docker compose up smoke)
  • CI: default matrix + the new publishing workflow step runs on release (Docker Hub + GHCR tokens still need to be configured in repo settings before the first release — see spec for the one-time setup checklist)

Pre-merge setup owners need to do:

  • Create docker-hub GitHub environment with DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets (workflow already references it)
  • Ensure repo Actions permissions allow GITHUB_TOKEN to write packages (for GHCR push)

🤖 Generated with Claude Code

Reshape the Docker experience around a single bind mount and a single
named volume. Global settings live on the host under
$HOME/.cocoindex_code/ (visible and editable); index data and the model
cache persist in one cocoindex-data volume; daemon runtime state stays
on the container's native filesystem.

CLI and MCP output now show host-side paths via a bidirectional
COCOINDEX_CODE_HOST_PATH_MAPPING translator. A shell wrapper that
forwards $PWD (COCOINDEX_CODE_HOST_CWD) lets ccc work from any project
subdirectory on the host.

The daemon tolerates a missing global_settings.yml (starts in
no-settings mode) so ccc init's interactive picker works in Docker on
first run. A supervisor restart loop in the entrypoint, driven by a new
COCOINDEX_CODE_DAEMON_SUPERVISED contract, makes settings-change
auto-restart safe — editing global_settings.yml triggers an in-place
daemon respawn without taking the container down.

Linux ownership alignment via PUID/PGID, gosu privilege drop, and a
coco user baked into the image. Release workflow now publishes to both
Docker Hub (cocoindex/cocoindex-code) and GHCR
(ghcr.io/cocoindex-io/cocoindex-code).

Also:
- Merge cocoindex-db and cocoindex-model-cache into a single volume
- find_parent_with_marker requires .cocoindex_code/settings.yml, so a
  workspace-root global-only dir doesn't trigger nested-init warnings
- New pytest marker `docker_e2e` gates the Docker-backed E2E suite
  (excluded from default pytest runs)
@georgeh0 georgeh0 merged commit 92d6119 into main Apr 14, 2026
4 checks passed
@georgeh0 georgeh0 deleted the g/docker-unified-workspace branch April 14, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish the docker image

1 participant