Fix Docker startup issues

- Change executable from claude-code to claude in startup.sh
- Fix .env parsing to handle comments using set -a/source
- Add explicit PATH for npm global binaries in Dockerfile
- Update scratchpad.md with fix documentation
This commit is contained in:
Vishal Jain
2025-06-12 11:10:32 +01:00
parent 0ec49a426a
commit 7c14a75afc
7 changed files with 57 additions and 39 deletions

View File

@@ -16,15 +16,15 @@ if [ ! -f "$HOME/.claude-docker/.env" ]; then
fi
# Add alias to .zshrc
ALIAS_LINE="alias claude='$PROJECT_ROOT/scripts/claude-docker.sh'"
ALIAS_LINE="alias claude-docker='$PROJECT_ROOT/scripts/claude-docker.sh'"
if ! grep -q "alias claude=" "$HOME/.zshrc"; then
if ! grep -q "alias claude-docker=" "$HOME/.zshrc"; then
echo "" >> "$HOME/.zshrc"
echo "# Claude Docker alias" >> "$HOME/.zshrc"
echo "$ALIAS_LINE" >> "$HOME/.zshrc"
echo "✓ Added 'claude' alias to .zshrc"
echo "✓ Added 'claude-docker' alias to .zshrc"
else
echo "✓ Claude alias already exists in .zshrc"
echo "✓ Claude-docker alias already exists in .zshrc"
fi
# Make scripts executable
@@ -35,6 +35,7 @@ echo ""
echo "Installation complete! 🎉"
echo ""
echo "Next steps:"
echo "1. Edit $HOME/.claude-docker/.env with your API keys"
echo "1. (Optional) Edit $HOME/.claude-docker/.env with your API keys"
echo "2. Run 'source ~/.zshrc' or start a new terminal"
echo "3. Navigate to any project and run 'claude' to start"
echo "3. Navigate to any project and run 'claude-docker' to start"
echo "4. If no API key, Claude will prompt for interactive authentication"

View File

@@ -1,23 +1,23 @@
#!/bin/bash
# ABOUTME: Startup script for Claude Code container with MCP server
# ABOUTME: Launches Twilio MCP server then starts Claude Code with permissions bypass
# ABOUTME: Configures environment and starts Claude Code with Twilio MCP integration
# Load environment variables from .env if it exists
if [ -f /app/.env ]; then
export $(cat /app/.env | grep -v '^#' | xargs)
set -a
source /app/.env 2>/dev/null || true
set +a
fi
# Start Twilio MCP server in the background
echo "Starting Twilio MCP server..."
npx @twilioalpha/mcp-server-twilio &
MCP_PID=$!
# Give MCP server time to start
sleep 2
# Configure Claude Code to use the MCP server
export CLAUDE_MCP_CONFIG=/app/config/mcp-config.json
# Start Claude Code with permissions bypass
echo "Starting Claude Code..."
exec claude-code --dangerously-skip-permissions "$@"
if [ -n "$TWILIO_ACCOUNT_SID" ] && [ -n "$TWILIO_API_KEY" ]; then
echo "Twilio MCP integration enabled"
else
echo "No Twilio credentials found, MCP features will be unavailable"
fi
echo "Note: If prompted for authentication, follow the interactive prompts"
exec claude --dangerously-skip-permissions "$@"