Add Docker support with comprehensive deployment options

- Add multi-stage Dockerfile with optimized builds for Go backend and Node.js frontend
- Create docker-entrypoint.sh script for managing both services with PM2
- Add .dockerignore for optimal build context
- Update README.md with Docker deployment documentation including:
  - Docker build and run instructions
  - Persistent data configuration with volume mounts
  - Complete environment variable reference table
  - Docker Compose example configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Arseniy Ivanov 2025-08-03 17:15:09 -04:00
parent 9cb513019d
commit 602452b162
4 changed files with 375 additions and 3 deletions

View file

@ -22,12 +22,14 @@ Claude Code Proxy serves two main purposes:
## Quick Start
### Prerequisites
- Go 1.20+
- Node.js 18+
- **Option 1**: Go 1.20+ and Node.js 18+ (for local development)
- **Option 2**: Docker (for containerized deployment)
- Claude Code
### Installation
#### Option 1: Local Development
1. **Clone the repository**
```bash
git clone https://github.com/seifghazi/claude-code-proxy.git
@ -57,7 +59,59 @@ Claude Code Proxy serves two main purposes:
./run.sh
```
5. **Using with Claude Code**
#### Option 2: Docker
1. **Clone the repository**
```bash
git clone https://github.com/seifghazi/claude-code-proxy.git
cd claude-code-proxy
```
2. **Build and run with Docker**
```bash
# Build the image
docker build -t claude-code-proxy .
# Run with default settings
docker run -p 3001:3001 -p 5173:5173 claude-code-proxy
```
3. **Run with persistent data and custom configuration**
```bash
# Create a data directory for persistent SQLite database
mkdir -p ./data
# Run with volume mount and custom environment variables
docker run -p 3001:3001 -p 5173:5173 \
-v ./data:/app/data \
-e ANTHROPIC_FORWARD_URL=https://api.anthropic.com \
-e PORT=3001 \
-e WEB_PORT=5173 \
claude-code-proxy
```
4. **Docker Compose (alternative)**
```yaml
# docker-compose.yml
version: '3.8'
services:
claude-code-proxy:
build: .
ports:
- "3001:3001"
- "5173:5173"
volumes:
- ./data:/app/data
environment:
- ANTHROPIC_FORWARD_URL=https://api.anthropic.com
- PORT=3001
- WEB_PORT=5173
- DB_PATH=/app/data/requests.db
```
Then run: `docker-compose up`
### Using with Claude Code
To use this proxy with Claude Code, set:
```bash
@ -100,6 +154,7 @@ make help # Show all commands
## Configuration
### Local Development
Create a `.env` file with:
```
PORT=3001
@ -109,6 +164,33 @@ ANTHROPIC_FORWARD_URL=https://api.anthropic.com
See `.env.example` for all available options.
### Docker Environment Variables
All environment variables can be configured when running the Docker container:
| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | `3001` | Proxy server port |
| `WEB_PORT` | `5173` | Web dashboard port |
| `READ_TIMEOUT` | `600` | Server read timeout (seconds) |
| `WRITE_TIMEOUT` | `600` | Server write timeout (seconds) |
| `IDLE_TIMEOUT` | `600` | Server idle timeout (seconds) |
| `ANTHROPIC_FORWARD_URL` | `https://api.anthropic.com` | Target Anthropic API URL |
| `ANTHROPIC_VERSION` | `2023-06-01` | Anthropic API version |
| `ANTHROPIC_MAX_RETRIES` | `3` | Maximum retry attempts |
| `DB_PATH` | `/app/data/requests.db` | SQLite database path |
Example with custom configuration:
```bash
docker run -p 3001:3001 -p 5173:5173 \
-v ./data:/app/data \
-e PORT=8080 \
-e WEB_PORT=3000 \
-e ANTHROPIC_FORWARD_URL=https://api.anthropic.com \
-e DB_PATH=/app/data/custom.db \
claude-code-proxy
```
## Project Structure