fix: agents Dockerfile fails to build — cli.anthropic.com DNS does not resolve (#637)

- Remove curl|sh Claude CLI download from Dockerfile (no internet needed)
- Mount host Claude CLI binary into container via docker-compose volume
- generate_compose() resolves host claude path at init time
- entrypoint.sh fails fast with clear error if claude CLI is missing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-24 22:26:26 +00:00
parent d7d2d1e12f
commit 7844b29a37
3 changed files with 26 additions and 4 deletions

View file

@ -204,6 +204,7 @@ services:
- project-repos:/home/agent/repos
- ./:/home/agent/disinto:ro
- claude-auth:/home/agent/.claude:ro
- CLAUDE_BIN_PLACEHOLDER:/usr/local/bin/claude:ro
environment:
FORGE_URL: http://forgejo:3000
WOODPECKER_SERVER: http://woodpecker:8000
@ -228,6 +229,18 @@ networks:
driver: bridge
COMPOSEEOF
# Patch the Claude CLI binary path — resolve from host PATH at init time.
local claude_bin
claude_bin="$(command -v claude 2>/dev/null || true)"
if [ -n "$claude_bin" ]; then
# Resolve symlinks to get the real binary path
claude_bin="$(readlink -f "$claude_bin")"
sed -i "s|CLAUDE_BIN_PLACEHOLDER|${claude_bin}|" "$compose_file"
else
echo "Warning: claude CLI not found in PATH — update docker-compose.yml volumes manually" >&2
sed -i "s|CLAUDE_BIN_PLACEHOLDER|/usr/local/bin/claude|" "$compose_file"
fi
# Patch the forgejo port mapping into the file if non-default
if [ "$forge_port" != "3000" ]; then
# Add port mapping to forgejo service so it's reachable from host during init