Skip to content

feat: add Docker support with compose#114

Open
sivlek14 wants to merge 2 commits into
phuryn:mainfrom
sivlek14:feat/docker-support
Open

feat: add Docker support with compose#114
sivlek14 wants to merge 2 commits into
phuryn:mainfrom
sivlek14:feat/docker-support

Conversation

@sivlek14
Copy link
Copy Markdown

@sivlek14 sivlek14 commented May 8, 2026

Summary

  • Adds Dockerfile (Python 3.12-slim base, copies the three source files, sets HOST=0.0.0.0 PORT=8080, runs scan then serves)
  • Adds compose.yaml: bind-mounts ~/.claude so the SQLite DB at ~/.claude/usage.db persists on the host and CLI commands keep working alongside the container; exposes port 8080
  • Adds .dockerignore to keep the image lean
  • Updates README.md with a ### Docker quick-start and docker compose run examples for one-shot CLI commands

Usage

docker compose up -d
# Open http://localhost:8080

# One-shot CLI commands without starting the server:
docker compose run --rm claude-usage python3 cli.py today
docker compose run --rm claude-usage python3 cli.py stats

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 green
  • Manual: docker compose up -d && curl -fsS http://localhost:8080 && docker compose down

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 8, 2026 04:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Dockerfile to run scan() once at container start and then serve the dashboard on port 8080.
  • Adds compose.yaml to build/run the service, publish port 8080, and bind-mount the host’s ~/.claude into 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.

Comment thread compose.yaml Outdated
Comment thread compose.yaml
ports:
- "8080:8080"
volumes:
# JSONL logs (read) + usage.db (read/write)
Comment thread compose.yaml
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

def test_compose_mounts_claude_home(self):
compose = (ROOT / "compose.yaml").read_text()
self.assertTrue(
re.search(r"(~|\$HOME|\$\{HOME\})/\.claude", compose),
Comment thread compose.yaml
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 thread README.md
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:

@sivlek14
Copy link
Copy Markdown
Author

sivlek14 commented May 8, 2026

@copilot apply changes based on the comments in this thread

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.

2 participants