-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (56 loc) · 2.25 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (56 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Ralph - Autonomous Claude Code Runner for GitHub Issues
#
# Build: docker build -t ralph:latest .
# Run: docker run --rm \
# -e GITHUB_TOKEN=xxx \
# -e ANTHROPIC_API_KEY=xxx \
# -v ~/.ssh/id_rsa:/home/ralph/.ssh/id_rsa:ro \
# ralph:latest git@github.com:owner/repo.git 42 fix/issue-42
FROM node:20-slim
LABEL maintainer="Ralph Bot" \
description="Autonomous Claude Code runner for GitHub issues" \
version="1.0.0"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
openssh-client \
curl \
jq \
bc \
ca-certificates \
gpg \
&& rm -rf /var/lib/apt/lists/*
# Install GitHub CLI (gh) for forking repos and creating PRs
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y gh \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI globally
RUN npm install -g @anthropic-ai/claude-code
# Note: This implementation uses the "Ralph Wiggum" iterative loop technique
# See: https://awesomeclaude.ai/ralph-wiggum
# The loop is implemented in entrypoint.sh rather than using the Claude plugin
# Use existing 'node' user (UID 1000) instead of creating new user
# (required: Claude Code won't run --dangerously-skip-permissions as root)
RUN mkdir -p /home/node/.ssh && \
chown -R node:node /home/node
# Create working directory and set ownership
WORKDIR /ralph
RUN chown -R node:node /ralph
# Copy the entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint
# Set default environment variables
ENV MAX_ITERATIONS=10 \
ITERATION_DELAY=5 \
WORKDIR=/tmp/ralph-workspace \
HOME=/home/node
# Health check - verify claude is installed
RUN claude --version || echo "Claude CLI installed"
# Switch to non-root user
USER node
# Entry point
ENTRYPOINT ["/usr/local/bin/entrypoint"]
# Default help message if no args provided
CMD ["--help"]