File tree Expand file tree Collapse file tree 6 files changed +148
-2
lines changed
Expand file tree Collapse file tree 6 files changed +148
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ branches : [ main, docker ]
6+ pull_request :
7+ branches : [ main ]
8+ release :
9+ types : [ published ]
10+
11+ env :
12+ REGISTRY : ghcr.io
13+ IMAGE_NAME : ${{ github.repository }}
14+
15+ jobs :
16+ build :
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ packages : write
21+
22+ steps :
23+ - name : Checkout repository
24+ uses : actions/checkout@v4
25+
26+ - name : Set up Docker Buildx
27+ uses : docker/setup-buildx-action@v3
28+
29+ - name : Log in to Container Registry
30+ uses : docker/login-action@v3
31+ with :
32+ registry : ${{ env.REGISTRY }}
33+ username : ${{ github.actor }}
34+ password : ${{ secrets.GITHUB_TOKEN }}
35+
36+ - name : Extract metadata
37+ id : meta
38+ uses : docker/metadata-action@v5
39+ with :
40+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+ tags : |
42+ type=ref,event=branch
43+ type=ref,event=pr
44+ type=semver,pattern={{version}}
45+ type=semver,pattern={{major}}.{{minor}}
46+ type=raw,value=latest,enable={{is_default_branch}}
47+
48+ - name : Build and push Docker image
49+ uses : docker/build-push-action@v5
50+ with :
51+ context : .
52+ push : true
53+ tags : ${{ steps.meta.outputs.tags }}
54+ labels : ${{ steps.meta.outputs.labels }}
55+ cache-from : type=gha
56+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 1+ # Use official Python runtime as base image
2+ FROM python:3.9-slim
3+
4+ # Set working directory in the container
5+ WORKDIR /app
6+
7+ # Install Node.js and npm for ccusage CLI tool
8+ RUN apt-get update && apt-get install -y \
9+ curl \
10+ && rm -rf /var/lib/apt/lists/*
11+
12+ # Install Node.js 18.x
13+ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
14+ && apt-get install -y nodejs
15+
16+ # Install ccusage globally
17+ RUN npm install -g ccusage
18+
19+ # Copy Python requirements and install Python dependencies
20+ COPY requirements.txt .
21+ RUN pip install --no-cache-dir -r requirements.txt
22+
23+ # Create the directory structure that ccusage expects
24+ RUN mkdir -p "/root/.claude"
25+
26+ # Copy the Python script
27+ COPY ccusage_monitor.py .
28+
29+ # Make the script executable
30+ RUN chmod +x ccusage_monitor.py
31+
32+ # Set the entrypoint to run the monitor
33+ ENTRYPOINT ["python" , "./ccusage_monitor.py" ]
Original file line number Diff line number Diff line change @@ -55,8 +55,35 @@ A beautiful real-time terminal monitoring tool for Claude AI token usage. Track
5555
5656## 🚀 Installation
5757
58- ### Prerequisites
58+ ### Method 1: Docker (Recommended for non-technical users)
5959
60+ ** Prerequisites:**
61+ - Docker and Docker Compose installed on your system
62+
63+ ** Super Simple Setup:**
64+
65+ ``` bash
66+ # Clone the repository
67+ git clone https://github.com/amphora/Claude-Code-Usage-Monitor.git
68+ cd Claude-Code-Usage-Monitor
69+
70+ # Run with pre-built image (no build time!)
71+ docker-compose up
72+
73+ # Or run with custom options
74+ docker-compose run claude-monitor --plan max5 --timezone US/Eastern
75+ ```
76+
77+ ** Development Setup (build locally):**
78+
79+ ``` bash
80+ # Build and run locally
81+ docker-compose -f docker-compose.local.yml up --build
82+ ```
83+
84+ ### Method 2: Local Installation
85+
86+ ** Prerequisites:**
60871 . ** Python 3.6+** installed on your system
61882 . ** pytz** Python package:
6289 ``` bash
@@ -67,7 +94,7 @@ A beautiful real-time terminal monitoring tool for Claude AI token usage. Track
6794 npm install -g ccusage
6895 ```
6996
70- ### Quick Setup
97+ ** Quick Setup: **
7198
7299``` bash
73100# Clone the repository
Original file line number Diff line number Diff line change 1+ services :
2+ claude-monitor :
3+ build : .
4+ container_name : claude-usage-monitor-local
5+ stdin_open : true
6+ tty : true
7+ # Mount the host's Claude Code data directory (contains JSONL files)
8+ volumes :
9+ - " ${HOME}/.claude:/root/.claude:ro"
10+ environment :
11+ - HOME=/root
12+ # Default arguments - users can override with docker-compose run
13+ command : ["--plan", "pro"]
14+ # Example: docker-compose -f docker-compose.local.yml run claude-monitor --plan max5
Original file line number Diff line number Diff line change 1+ services :
2+ claude-monitor :
3+ image : ghcr.io/amphora/claude-code-usage-monitor:latest
4+ container_name : claude-usage-monitor
5+ stdin_open : true
6+ tty : true
7+ # Mount the host's Claude Code data directory (contains JSONL files)
8+ volumes :
9+ - " ${HOME}/.claude:/root/.claude:ro"
10+ environment :
11+ - HOME=/root
12+ # Default arguments - users can override with docker-compose run
13+ command : ["--plan", "pro"]
14+ # Example: docker-compose run claude-monitor --plan max5 --timezone US/Eastern
15+ # To build locally instead: docker-compose -f docker-compose.local.yml up
Original file line number Diff line number Diff line change 1+ pytz >= 2021.1
You can’t perform that action at this time.
0 commit comments