53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
# ============================================================
|
|
# Claude Code - Docker Swarm Stack (Option 1: Minimal)
|
|
# ============================================================
|
|
# Uses your Claude Pro/Max subscription via an OAuth token.
|
|
# No API key = no per-token charges.
|
|
#
|
|
# One-time setup (run on your host, NOT inside the container):
|
|
# 1. Install Claude Code locally: npm install -g @anthropic-ai/claude-code
|
|
# 2. Generate a long-lived token: claude setup-token
|
|
# (opens browser, authorize with your claude.ai account)
|
|
# 3. Copy the printed token (starts with sk-ant-oat01-...)
|
|
# 4. Store it as a Docker secret:
|
|
# echo -n "sk-ant-oat01-..." | docker secret create claude_oauth_token -
|
|
# 5. Deploy:
|
|
# docker stack deploy -c claude-code-swarm-minimal.yml claude
|
|
# ============================================================
|
|
|
|
version: "3.8"
|
|
|
|
secrets:
|
|
claude_oauth_token:
|
|
external: true # Created with: echo -n "sk-ant-oat01-..." | docker secret create claude_oauth_token -
|
|
|
|
services:
|
|
claude-code:
|
|
image: ghcr.io/anthropics/claude-code:latest
|
|
stdin_open: true # Required for interactive terminal
|
|
tty: true # Required for interactive terminal
|
|
working_dir: /workspace
|
|
secrets:
|
|
- claude_oauth_token
|
|
environment:
|
|
# Tells Claude Code to use the OAuth token (subscription), not an API key
|
|
- CLAUDE_CODE_OAUTH_TOKEN_FILE=/run/secrets/claude_oauth_token
|
|
volumes:
|
|
- workspace:/workspace
|
|
networks:
|
|
- claude-net
|
|
deploy:
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
|
|
volumes:
|
|
workspace:
|
|
driver: local
|
|
|
|
networks:
|
|
claude-net:
|
|
driver: overlay
|