forked from claude-did-this/claude-hub
This comprehensive update adds support for Claude Max subscription authentication and improves the overall authentication system with multiple methods: 🔐 Claude Authentication Enhancements: - Add setup container method for Claude Max/20x subscription usage ($20-200/month) - Create interactive authentication script (setup-claude-interactive.sh) - Add authentication testing utility (test-claude-auth.sh) - Support three authentication methods: Setup Container, API Key, AWS Bedrock - Comprehensive authentication documentation 📁 Directory Configuration: - Add CLAUDE_HUB_DIR environment variable (default: ~/.claude-hub) - Update .gitignore to use .claude-hub/ instead of hardcoded paths - Consistent environment variable usage across all scripts 🐙 GitHub Token Support: - Add fine-grained GitHub token support (github_pat_) alongside classic tokens (ghp_) - Update token validation in claudeService and githubService - Enhanced token detection and authentication flow 📖 Documentation & Guides: - Add complete Claude Authentication Guide with all three methods - Add Setup Container Deep Dive documentation - Update CLAUDE.md with quick start authentication section - Comprehensive cost comparison and use case recommendations 🐳 Container & Docker Improvements: - Update Dockerfile.claudecode with proper entrypoint script copying - Add Dockerfile.claude-setup for interactive authentication - Update docker-compose.yml with new port (3003) and environment variables - Enhanced container volume mounting for authentication 🔧 Infrastructure Updates: - Add TRUST_PROXY configuration for reverse proxy environments - Update port configuration from 3002 to 3003 - Enhanced environment variable documentation in .env.example - Debug utilities for troubleshooting authentication issues This update enables Claude Max subscribers to use their existing subscriptions for automation, potentially saving thousands in API costs while maintaining full production capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
90 lines
2.4 KiB
Docker
90 lines
2.4 KiB
Docker
FROM node:24
|
|
|
|
# Install dependencies for interactive session
|
|
RUN apt update && apt install -y \
|
|
git \
|
|
sudo \
|
|
zsh \
|
|
curl \
|
|
vim \
|
|
nano \
|
|
gh
|
|
|
|
# Set up npm global directory
|
|
RUN mkdir -p /usr/local/share/npm-global && \
|
|
chown -R node:node /usr/local/share
|
|
|
|
# Switch to node user for npm install
|
|
USER node
|
|
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
|
ENV PATH=$PATH:/usr/local/share/npm-global/bin
|
|
|
|
# Install Claude Code
|
|
RUN npm install -g @anthropic-ai/claude-code
|
|
|
|
# Switch back to root for setup
|
|
USER root
|
|
|
|
# Create authentication workspace
|
|
RUN mkdir -p /auth-setup && chown -R node:node /auth-setup
|
|
|
|
# Set up interactive shell environment
|
|
ENV SHELL /bin/zsh
|
|
WORKDIR /auth-setup
|
|
|
|
# Create setup script that captures authentication state
|
|
RUN cat > /setup-claude-auth.sh << 'EOF'
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
echo "🔧 Claude Authentication Setup Container"
|
|
echo "========================================"
|
|
echo ""
|
|
echo "This container allows you to authenticate with Claude interactively"
|
|
echo "and capture the authentication state for use in other containers."
|
|
echo ""
|
|
echo "Instructions:"
|
|
echo "1. Run: claude login"
|
|
echo "2. Follow the authentication flow"
|
|
echo "3. Test with: claude status"
|
|
echo "4. Type 'exit' when authentication is working"
|
|
echo ""
|
|
echo "The ~/.claude directory will be preserved in /auth-output"
|
|
echo ""
|
|
|
|
# Function to copy authentication state
|
|
copy_auth_state() {
|
|
if [ -d "/home/node/.claude" ] && [ -d "/auth-output" ]; then
|
|
echo "💾 Copying authentication state..."
|
|
cp -r /home/node/.claude/* /auth-output/ 2>/dev/null || true
|
|
cp -r /home/node/.claude/.* /auth-output/ 2>/dev/null || true
|
|
chown -R node:node /auth-output
|
|
echo "✅ Authentication state copied to /auth-output"
|
|
fi
|
|
}
|
|
|
|
# Set up signal handling to capture state on exit
|
|
trap copy_auth_state EXIT
|
|
|
|
# Create .claude directory for node user
|
|
sudo -u node mkdir -p /home/node/.claude
|
|
|
|
echo "🔐 Starting interactive shell as 'node' user..."
|
|
echo "💡 Tip: Run 'claude --version' to verify Claude CLI is available"
|
|
echo ""
|
|
|
|
# Switch to node user and start interactive shell
|
|
sudo -u node bash -c '
|
|
export HOME=/home/node
|
|
export PATH=/usr/local/share/npm-global/bin:$PATH
|
|
cd /home/node
|
|
echo "Environment ready! Claude CLI is available at: $(which claude || echo "/usr/local/share/npm-global/bin/claude")"
|
|
echo "Run: claude login"
|
|
exec bash -i
|
|
'
|
|
EOF
|
|
|
|
RUN chmod +x /setup-claude-auth.sh
|
|
|
|
# Set entrypoint to setup script
|
|
ENTRYPOINT ["/setup-claude-auth.sh"] |