38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
services:
|
|
claude-code:
|
|
build: .
|
|
image: claude-code:local
|
|
container_name: claude-code
|
|
|
|
# Pass your Anthropic API key in from the host environment,
|
|
# or drop it into a .env file alongside this compose file.
|
|
# environment:
|
|
# - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:?Set ANTHROPIC_API_KEY in your environment or .env file}
|
|
|
|
volumes:
|
|
# Fixed home volume — persists Claude Code install, config, and credentials
|
|
# across container restarts and image rebuilds.
|
|
- claude-home:/home/coder
|
|
|
|
# Swappable project folder — override PROJECT_DIR to point at any directory:
|
|
# PROJECT_DIR=/path/to/myproject docker compose run --rm claude-code
|
|
- ${PROJECT_DIR:-./code}:/code
|
|
|
|
# Drop all Linux capabilities and disable privilege escalation —
|
|
# Claude Code doesn't need any of them.
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
|
|
# Interactive terminal so `claude` works properly
|
|
stdin_open: true
|
|
tty: true
|
|
|
|
working_dir: /code
|
|
|
|
volumes:
|
|
claude-home:
|
|
# Named volume — Docker manages it; survives `docker compose down`
|
|
# (use `docker compose down -v` to wipe it along with the install)
|