claude-code-stack/claude-code-stack-docker-compose.yml
2026-04-04 14:32:22 -04:00

142 lines
3.6 KiB
YAML

version: '3.8'
services:
# Claude Code Agents UI - Frontend interface for agent management
agents-ui:
build:
context: ./claude-code-agents-ui
dockerfile: Dockerfile
container_name: claude-agents-ui
restart: unless-stopped
ports:
- "3000:3000"
environment:
# Point agents-ui to the Claude Code backend
CLAUDE_DIR: /root/.claude
NODE_ENV: production
volumes:
# Mount Claude configuration directory
- claude-config:/root/.claude
# Mount workspace directory for agent projects
- workspace:/workspace
depends_on:
- claude-code-backend
networks:
- claude-stack
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Claude Code Runtime - Backend service for code execution
claude-code-backend:
image: ghcr.io/anthropics/claude-code:latest
container_name: claude-code-runtime
restart: unless-stopped
ports:
- "5000:5000" # Internal API port if needed
environment:
# Required: Your Anthropic API key
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
# Optional: Use a custom API endpoint
# ANTHROPIC_BASE_URL: https://api.anthropic.com
# Claude model selection
CLAUDE_MODEL: claude-opus-4-1
# Workspace configuration
WORKSPACE_DIR: /workspace
volumes:
# Mount Claude configuration
- claude-config:/root/.claude
# Mount workspace for projects
- workspace:/workspace
# Mount SSH keys for git operations (read-only)
- ${HOME}/.ssh:/root/.ssh:ro
# Optional: Mount system package managers for agent access
# - /usr/local/bin:/usr/local/bin:ro
networks:
- claude-stack
healthcheck:
test: ["CMD", "test", "-d", "/workspace"]
interval: 30s
timeout: 10s
retries: 3
# Security: Run as non-root user
user: "0:0" # Can be configured for non-root if needed
# Optional: PostgreSQL for agent data persistence
postgres:
image: postgres:16-alpine
container_name: claude-postgres
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: claude
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeMe123!}
POSTGRES_DB: claude_agents
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- claude-stack
healthcheck:
test: ["CMD-SHELL", "pg_isready -U claude"]
interval: 10s
timeout: 5s
retries: 5
# Optional: Redis for caching and session management
redis:
image: redis:7-alpine
container_name: claude-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- claude-stack
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Optional: Nginx reverse proxy for production setup
nginx:
image: nginx:alpine
container_name: claude-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
# Uncomment for SSL:
# - ./certs:/etc/nginx/certs:ro
depends_on:
- agents-ui
- claude-code-backend
networks:
- claude-stack
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost"]
interval: 30s
timeout: 10s
retries: 3
volumes:
claude-config:
driver: local
workspace:
driver: local
postgres-data:
driver: local
redis-data:
driver: local
networks:
claude-stack:
driver: bridge