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:
@@ -0,0 +1,22 @@
|
||||
# Minimal codex config for the ai-chess container.
|
||||
# Uses the user's cliproxyapi gateway; the chess MCP server lives next door
|
||||
# (uvicorn on 127.0.0.1:7833 inside the same container) and is overridden
|
||||
# per-side via -c at launch time by scripts/pane-agent.sh.
|
||||
|
||||
model = "gpt-5.5"
|
||||
model_provider = "cliproxyapi"
|
||||
model_reasoning_effort = "xhigh"
|
||||
approval_policy = "never"
|
||||
sandbox_mode = "danger-full-access"
|
||||
service_tier = "fast"
|
||||
|
||||
[model_providers.cliproxyapi]
|
||||
name = "cliproxyapi"
|
||||
base_url = "https://cli.machka.dev/v1"
|
||||
wire_api = "responses"
|
||||
|
||||
[mcp_servers.chess]
|
||||
url = "http://127.0.0.1:7833/mcp/black"
|
||||
|
||||
[notice]
|
||||
hide_full_access_warning = true
|
||||
Reference in New Issue
Block a user