feat(docker): bake claude+codex CLI + auth into image, non-root user
Dockerfile additions:
- Node 20 (NodeSource repo) + @anthropic-ai/claude-code@2.1.141 via npm.
- codex 0.130.0 musl tarball from github releases, dropped into
/usr/local/bin/codex.
- jq + xz-utils + gnupg apt packages.
- Symlink /usr/games/stockfish → /usr/local/bin/stockfish (Debian
puts it under /usr/games which isn't on the default PATH).
- Non-root user 'chess' (uid 1000) because claude-code refuses to run
with --dangerously-skip-permissions as root; HOME=/home/chess.
- Pre-seeded /home/chess/.claude/settings.json + /home/chess/.claude.json:
- hasCompletedOnboarding=true / lastOnboardingVersion='2.1.141'
- projects['/app'].hasTrustDialogAccepted=true (mirrors the user's
claude-trust-current-dir helper, but baked since cwd is always /app)
- permissions.defaultMode='bypassPermissions'
- skipDangerousModePermissionPrompt=true
Without these, every fresh tmux pane hangs on the theme picker, then
the workspace-trust dialog, never reaching its first MCP call.
docker-compose.yml:
- ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN env (loaded from /opt/chessai/.env).
- ./secrets/codex mounted read-only at /home/chess/.codex so the user's
cliproxyapi-flavored codex config + auth.json travel with the deploy
but stay outside the image layers.
deploy/codex/config.toml:
- Minimal codex config (cliproxyapi provider, gpt-5.5 xhigh fast,
chess MCP url placeholder overridden per-side by pane-agent.sh).
scripts/pane-agent.sh:
- Use CLAUDE_BIN / CODEX_BIN from PATH (mac vs linux dynamics);
the inline -c mcp_servers.chess.url override removes the need for
'codex mcp add/remove' that polluted ~/.codex/config.toml on Mac runs.
Verified end-to-end on chess.danosito.com: AI-vs-AI game starts,
claude (white) inside the container makes the first move with a
toxic russian comment, MCP HTTP roundtrip works.
This commit is contained in:
+8
-1
@@ -7,16 +7,23 @@ services:
|
||||
environment:
|
||||
AI_CHESS_HOST: "0.0.0.0" # listen on all interfaces inside the container
|
||||
AI_CHESS_PORT: "7833"
|
||||
# claude-code auth — talks to user's machka gateway, no Anthropic
|
||||
# subscription needed at runtime.
|
||||
ANTHROPIC_BASE_URL: "${ANTHROPIC_BASE_URL:-https://claude.machka.dev}"
|
||||
ANTHROPIC_AUTH_TOKEN: "${ANTHROPIC_AUTH_TOKEN}"
|
||||
networks:
|
||||
default:
|
||||
caddy-network:
|
||||
aliases:
|
||||
- chessai
|
||||
# Persistent runtime data — survives container rebuilds.
|
||||
volumes:
|
||||
# Persistent runtime data — survives container rebuilds.
|
||||
- ./games:/app/games
|
||||
- ./logs:/app/logs
|
||||
- ./config:/app/config
|
||||
# codex config + auth lives in /opt/chessai/secrets/codex on the host
|
||||
# and is mapped into the container's $CODEX_HOME (= ~/.codex by default).
|
||||
- ./secrets/codex:/home/chess/.codex:ro
|
||||
|
||||
networks:
|
||||
caddy-network:
|
||||
|
||||
Reference in New Issue
Block a user