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:
parent
d7d2d1e12f
commit
7844b29a37
3 changed files with 26 additions and 4 deletions
13
bin/disinto
13
bin/disinto
|
|
@ -204,6 +204,7 @@ services:
|
||||||
- project-repos:/home/agent/repos
|
- project-repos:/home/agent/repos
|
||||||
- ./:/home/agent/disinto:ro
|
- ./:/home/agent/disinto:ro
|
||||||
- claude-auth:/home/agent/.claude:ro
|
- claude-auth:/home/agent/.claude:ro
|
||||||
|
- CLAUDE_BIN_PLACEHOLDER:/usr/local/bin/claude:ro
|
||||||
environment:
|
environment:
|
||||||
FORGE_URL: http://forgejo:3000
|
FORGE_URL: http://forgejo:3000
|
||||||
WOODPECKER_SERVER: http://woodpecker:8000
|
WOODPECKER_SERVER: http://woodpecker:8000
|
||||||
|
|
@ -228,6 +229,18 @@ networks:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
COMPOSEEOF
|
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
|
# Patch the forgejo port mapping into the file if non-default
|
||||||
if [ "$forge_port" != "3000" ]; then
|
if [ "$forge_port" != "3000" ]; then
|
||||||
# Add port mapping to forgejo service so it's reachable from host during init
|
# Add port mapping to forgejo service so it's reachable from host during init
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
bash curl git jq tmux cron python3 openssh-client ca-certificates \
|
bash curl git jq tmux cron python3 openssh-client ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Claude CLI — install and verify
|
# Claude CLI is mounted from the host via docker-compose volume.
|
||||||
RUN curl -fsSL https://cli.anthropic.com/install.sh | sh \
|
# No internet access to cli.anthropic.com required at build time.
|
||||||
&& cp "$(find /root -name claude -type f 2>/dev/null | head -1)" /usr/local/bin/claude \
|
|
||||||
&& claude --version
|
|
||||||
|
|
||||||
# Non-root user
|
# Non-root user
|
||||||
RUN useradd -m -u 1000 -s /bin/bash agent
|
RUN useradd -m -u 1000 -s /bin/bash agent
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,17 @@ with open(sys.argv[1], 'rb') as f:
|
||||||
}
|
}
|
||||||
|
|
||||||
log "Agent container starting"
|
log "Agent container starting"
|
||||||
|
|
||||||
|
# Verify Claude CLI is available (expected via volume mount from host).
|
||||||
|
if ! command -v claude &>/dev/null; then
|
||||||
|
log "FATAL: claude CLI not found in PATH."
|
||||||
|
log "Mount the host binary into the container, e.g.:"
|
||||||
|
log " volumes:"
|
||||||
|
log " - /usr/local/bin/claude:/usr/local/bin/claude:ro"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
log "Claude CLI: $(claude --version 2>&1 || true)"
|
||||||
|
|
||||||
install_project_crons
|
install_project_crons
|
||||||
|
|
||||||
# Run cron in the foreground. Cron jobs execute as the agent user.
|
# Run cron in the foreground. Cron jobs execute as the agent user.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue