Initial: OpenClaw + Claude Pro Proxy with CI/CD
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
This commit is contained in:
49
entrypoint.sh
Normal file
49
entrypoint.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
MODE="${1:-run}"
|
||||
|
||||
if [ "$MODE" = "auth" ]; then
|
||||
echo "=== Claude Code Authentication ==="
|
||||
echo "Run 'claude login' to authenticate with your Max subscription."
|
||||
echo "Credentials are saved to the mounted volume at ~/.claude"
|
||||
echo ""
|
||||
exec claude login
|
||||
fi
|
||||
|
||||
if [ "$MODE" = "shell" ]; then
|
||||
exec /bin/bash
|
||||
fi
|
||||
|
||||
echo "Checking Claude Code authentication..."
|
||||
if ! claude --version > /dev/null 2>&1; then
|
||||
echo "ERROR: Claude Code CLI not working."
|
||||
echo "Run: docker compose run --rm openclaw auth"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$HOME/.claude/.credentials.json" ] && [ -z "$ANTHROPIC_API_KEY" ]; then
|
||||
echo "ERROR: No Claude credentials found."
|
||||
echo "Run: docker compose run --rm openclaw auth"
|
||||
exit 1
|
||||
fi
|
||||
echo "Claude Code CLI authenticated."
|
||||
|
||||
echo "Starting claude-max-api-proxy on :3456..."
|
||||
node /opt/claude-max-api-proxy/dist/server/standalone.js &
|
||||
PROXY_PID=$!
|
||||
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://127.0.0.1:3456/health > /dev/null 2>&1; then
|
||||
echo "Proxy ready."
|
||||
break
|
||||
fi
|
||||
[ $i -eq 30 ] && echo "ERROR: Proxy timeout." && exit 1
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Starting OpenClaw gateway on :18789..."
|
||||
cd /opt/openclaw
|
||||
exec node dist/index.js gateway \
|
||||
--bind "${OPENCLAW_GATEWAY_BIND:-lan}" \
|
||||
--port 18789
|
||||
Reference in New Issue
Block a user