feat: add Docker support with compose#114
Open
sivlek14 wants to merge 2 commits into
Open
Conversation
Adds Dockerfile, compose.yaml, and .dockerignore so the dashboard can be served with `docker compose up -d`. The container bind-mounts ~/.claude so the SQLite DB at ~/.claude/usage.db persists on the host and CLI commands keep working alongside the running server. README updated with Docker quick-start and docker compose run examples. tests/test_docker_setup.py adds static stdlib-only checks for the Dockerfile base image, exposed port, and ~/.claude mount. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds containerization support so the dashboard and CLI can be run via Docker/Docker Compose while persisting the local ~/.claude/usage.db database on the host.
Changes:
- Adds a
Dockerfileto runscan()once at container start and then serve the dashboard on port 8080. - Adds
compose.yamlto build/run the service, publish port 8080, and bind-mount the host’s~/.claudeinto the container. - Adds
.dockerignore, README Docker quick-start, and a small unittest file to statically validate Docker artifacts exist and contain expected settings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Dockerfile |
Builds a minimal Python 3.12-slim image and runs scan + dashboard server on port 8080. |
compose.yaml |
Defines the service, port mapping, and host ~/.claude bind mount for DB persistence. |
.dockerignore |
Reduces Docker build context size. |
README.md |
Documents Docker/Compose usage patterns, including one-shot CLI invocations. |
tests/test_docker_setup.py |
Adds stdlib-only static checks for presence/expected content of Docker config files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ports: | ||
| - "8080:8080" | ||
| volumes: | ||
| # JSONL logs (read) + usage.db (read/write) |
Comment on lines
+5
to
+11
| ports: | ||
| - "8080:8080" | ||
| volumes: | ||
| # JSONL logs (read) + usage.db (read/write) | ||
| - ${HOME}/.claude:/root/.claude | ||
| # Optional: Xcode Claude integration logs (macOS only) | ||
| # - ${HOME}/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/projects:/root/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/projects:ro |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| def test_compose_mounts_claude_home(self): | ||
| compose = (ROOT / "compose.yaml").read_text() | ||
| self.assertTrue( | ||
| re.search(r"(~|\$HOME|\$\{HOME\})/\.claude", compose), |
Comment on lines
+5
to
+11
| ports: | ||
| - "8080:8080" | ||
| volumes: | ||
| # JSONL logs (read) + usage.db (read/write) | ||
| - ${HOME:?HOME must be set}/.claude:/root/.claude | ||
| # Optional: Xcode Claude integration logs (macOS only) | ||
| # - ${HOME}/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/projects:/root/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/projects:ro |
Comment on lines
+63
to
+67
| persists on the host and CLI commands (`python3 cli.py today`) keep working | ||
| alongside the container. | ||
|
|
||
| To run single-shot CLI commands without starting the server: | ||
|
|
Author
|
@copilot apply changes based on the comments in this thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dockerfile(Python 3.12-slim base, copies the three source files, setsHOST=0.0.0.0 PORT=8080, runs scan then serves)compose.yaml: bind-mounts~/.claudeso the SQLite DB at~/.claude/usage.dbpersists on the host and CLI commands keep working alongside the container; exposes port 8080.dockerignoreto keep the image leanREADME.mdwith a### Dockerquick-start anddocker compose runexamples for one-shot CLI commandsUsage
Test plan
python3 -m unittest tests.test_docker_setup -v— 3 static checks pass (stdlib-only, no docker daemon required)python3 -m unittest discover -s tests -v— full suite greendocker compose up -d && curl -fsS http://localhost:8080 && docker compose down🤖 Generated with Claude Code