mirror of
https://github.com/claude-did-this/claude-hub.git
synced 2026-02-15 03:31:47 +01:00
* fix: Standardize Docker image naming and improve environment variable handling - Standardize on 'claudecode:latest' image name across the codebase - Update build script to use claudecode:latest instead of claude-code-runner:latest - Fix health check to use CLAUDE_CONTAINER_IMAGE env var dynamically - Improve environment variable handling for git configuration - Pass BOT_EMAIL and BOT_USERNAME to containers - Entrypoint scripts already use these with appropriate defaults - Add comprehensive environment variables documentation - Document all 90+ environment variables used in the project - Identify hard-coded values that could be made configurable - Update .env.example with missing variables This ensures consistency in Docker image naming and allows proper git configuration in containers using the configured bot identity. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Add BOT_EMAIL to docker-compose.yml - Add BOT_EMAIL environment variable to docker-compose.yml - Ensures git configuration in containers uses proper email address - Complements the previous changes for environment variable handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Use BOT_USERNAME environment variable in prompt creation - Fix undefined BOT_USERNAME reference in createPrompt function - Change prompt to use actual bot username instead of hardcoded "Claude" - Makes the prompt more accurate: "You are @MCPClaude" instead of "You are Claude" This fixes the PR review functionality that was broken due to the undefined variable reference. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: Add verbose and stream-json output to Claude CLI for better debugging - Add --verbose flag to see detailed Claude processing - Add --output-format stream-json for structured output - Helps diagnose issues with PR review and other operations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Use colon syntax for allowedTools in PR review to match auto-tagging - Change from space syntax Bash(gh *) to colon syntax Bash(gh:*) - This matches the working syntax used in auto-tagging - Should fix the permission issues preventing PR reviews from posting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: Add Claude Code timeout configuration for unattended mode - Add BASH_DEFAULT_TIMEOUT_MS (10 minutes) and BASH_MAX_TIMEOUT_MS (20 minutes) - Pass timeout environment variables to Claude container - Document new timeout settings in .env.example and environment-variables.md - Better defaults for webhook mode where builds/tests may take longer These timeouts are more suitable for unattended PR reviews and other operations that might involve long-running commands like builds or tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
138 lines
3.8 KiB
Bash
Executable File
138 lines
3.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Consolidated build script
|
|
# Usage: ./build.sh [claude|claudecode|production]
|
|
|
|
set -e
|
|
|
|
BUILD_TYPE=${1:-claudecode}
|
|
|
|
case "$BUILD_TYPE" in
|
|
claude)
|
|
echo "Building Claude container..."
|
|
docker build -f Dockerfile.claude -t claude-container:latest .
|
|
;;
|
|
|
|
claudecode)
|
|
echo "Building Claude Code runner Docker image..."
|
|
docker build -f Dockerfile.claudecode -t claudecode:latest .
|
|
;;
|
|
|
|
production)
|
|
if [ ! -d "./claude-config" ]; then
|
|
echo "Error: claude-config directory not found."
|
|
echo "Please run ./scripts/setup/setup-claude-auth.sh first and copy the config."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Building production image with pre-authenticated config..."
|
|
|
|
# Create a temporary production Dockerfile with claude-config enabled
|
|
cat > Dockerfile.claudecode.prod << 'EOF'
|
|
FROM node:24
|
|
|
|
# Install dependencies
|
|
RUN apt update && apt install -y less \
|
|
git \
|
|
procps \
|
|
sudo \
|
|
fzf \
|
|
zsh \
|
|
man-db \
|
|
unzip \
|
|
gnupg2 \
|
|
gh \
|
|
iptables \
|
|
ipset \
|
|
iproute2 \
|
|
dnsutils \
|
|
aggregate \
|
|
jq
|
|
|
|
# Set up npm global directory
|
|
RUN mkdir -p /usr/local/share/npm-global && \
|
|
chown -R node:node /usr/local/share
|
|
|
|
# Configure zsh and command history
|
|
ENV USERNAME=node
|
|
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
&& mkdir /commandhistory \
|
|
&& touch /commandhistory/.bash_history \
|
|
&& chown -R $USERNAME /commandhistory
|
|
|
|
# Create workspace and config directories
|
|
RUN mkdir -p /workspace /home/node/.claude && \
|
|
chown -R node:node /workspace /home/node/.claude
|
|
|
|
# Switch to node user temporarily 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
|
|
USER root
|
|
|
|
# Copy the pre-authenticated Claude config to BOTH root and node user (PRODUCTION ONLY)
|
|
COPY claude-config /root/.claude
|
|
COPY claude-config /home/node/.claude
|
|
RUN chown -R node:node /home/node/.claude
|
|
|
|
# Copy the rest of the setup
|
|
WORKDIR /workspace
|
|
|
|
# Install delta and zsh
|
|
RUN ARCH=$(dpkg --print-architecture) && \
|
|
wget "https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_${ARCH}.deb" && \
|
|
sudo dpkg -i "git-delta_0.18.2_${ARCH}.deb" && \
|
|
rm "git-delta_0.18.2_${ARCH}.deb"
|
|
|
|
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
|
|
-p git \
|
|
-p fzf \
|
|
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
|
-a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
|
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
-x
|
|
|
|
# Copy firewall and entrypoint scripts
|
|
COPY scripts/security/init-firewall.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
|
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
|
chmod 0440 /etc/sudoers.d/node-firewall
|
|
|
|
# Create scripts directory and copy unified entrypoint script
|
|
RUN mkdir -p /scripts/runtime
|
|
COPY scripts/runtime/claudecode-entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
COPY scripts/runtime/claudecode-entrypoint.sh /scripts/runtime/claudecode-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh && \
|
|
chmod +x /scripts/runtime/claudecode-entrypoint.sh
|
|
|
|
# Set the default shell to bash
|
|
ENV SHELL /bin/zsh
|
|
ENV DEVCONTAINER=true
|
|
|
|
# Run as root to allow permission management
|
|
USER root
|
|
|
|
# Use the custom entrypoint
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
EOF
|
|
|
|
# Build the production image
|
|
docker build -f Dockerfile.claudecode.prod -t claudecode:production .
|
|
|
|
# Clean up temporary file
|
|
rm -f Dockerfile.claudecode.prod
|
|
;;
|
|
|
|
*)
|
|
echo "Unknown build type: $BUILD_TYPE"
|
|
echo "Usage: ./build.sh [claude|claudecode|production]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo "Build complete!"
|