forked from ykdojo/claude-code-tips
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (52 loc) · 2.41 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (52 loc) · 2.41 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
# Claude Code Container with Gemini CLI fallback
# For running risky long-running agentic tasks in isolation
#
# Build:
# docker build -t claude-code-container -f Dockerfile .
#
# Run:
# docker run -it claude-code-container
#
# After starting, you need to manually authenticate:
# 1. Run `claude` and complete Anthropic login
# 2. Run `gemini` and complete Google login
FROM node:20-bookworm
# Install system dependencies
RUN apt-get update && apt-get install -y \
tmux \
jq \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code 2.0.57 (specific version for patching) and Gemini CLI
# Must be done as root for global npm install
RUN npm install -g @anthropic-ai/claude-code@2.0.57 @google/gemini-cli
# Clone the claude-code-tips repo
RUN git clone https://github.com/ykdojo/claude-code-tips.git /tmp/claude-code-tips
# Apply patches using the cloned repo (must be done as root)
RUN CLI_PATH=/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js && \
cp "$CLI_PATH" "$CLI_PATH.backup" && \
node /tmp/claude-code-tips/system-prompt/2.0.57/patch-cli.js "$CLI_PATH"
# Create claude user (don't run as root)
RUN useradd -m -s /bin/bash claude
# Set up directories and copy files from cloned repo
RUN mkdir -p /home/claude/.claude/scripts /home/claude/.claude/skills/reddit-fetch /home/claude/.gemini && \
cp /tmp/claude-code-tips/skills/reddit-fetch/SKILL.md /home/claude/.claude/skills/reddit-fetch/SKILL.md && \
cp /tmp/claude-code-tips/scripts/context-bar.sh /home/claude/.claude/scripts/context-bar.sh && \
chmod +x /home/claude/.claude/scripts/context-bar.sh && \
cp /tmp/claude-code-tips/container/setup.sh /home/claude/setup.sh && \
chmod +x /home/claude/setup.sh && \
chown -R claude:claude /home/claude && \
rm -rf /tmp/claude-code-tips
USER claude
WORKDIR /home/claude
# Set up aliases for convenience
RUN echo "alias c='claude'" >> ~/.bashrc && \
echo "alias g='gemini'" >> ~/.bashrc
# Set up status line in settings.json
RUN echo '{"statusLine":{"type":"command","command":"~/.claude/scripts/context-bar.sh"}}' > ~/.claude/settings.json
# Set up Gemini settings with model
RUN echo '{"security":{"auth":{"selectedType":"oauth-personal"}},"general":{"previewFeatures":true},"model":{"name":"gemini-3-pro-preview"}}' > ~/.gemini/settings.json
# Working directory for projects
WORKDIR /home/claude/workspace
# Run setup on container start
CMD ["/home/claude/setup.sh"]