From 1b1b808b50a8a29bc2447ae0dfd650ae57b83c59 Mon Sep 17 00:00:00 2001 From: Wheelz Date: Wed, 20 May 2026 20:19:23 -0500 Subject: [PATCH] Claude Docker Compose file --- claude-compose.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/claude-compose.yml b/claude-compose.yml index e69de29..32d62c1 100644 --- a/claude-compose.yml +++ b/claude-compose.yml @@ -0,0 +1,52 @@ +# ============================================================ +# 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