-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile
More file actions
127 lines (101 loc) · 5.82 KB
/
Dockerfile
File metadata and controls
127 lines (101 loc) · 5.82 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
FROM ubuntu:noble
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
ARG NODE_VERSION=24
ARG PLAYWRIGHT_MCP_VERSION=0.0.62
ARG CLAUDE_CODE_VERSION=2.1.32
ARG GEMINI_CLI_VERSION=0.26.0
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# === INSTALL Node.js ===
RUN apt-get update && \
# Install Node.js
apt-get install -y curl wget gpg ca-certificates && \
mkdir -p /etc/apt/keyrings && \
curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" >> /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs && \
# Feature-parity with node.js base images.
# Install GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/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" > /etc/apt/sources.list.d/github-cli.list && \
apt-get update && \
apt-get install -y gh && \
apt-get install -y --no-install-recommends git openssh-client jq tmux ttyd vim python3-pip && \
npm install -g yarn && \
# clean apt cache
rm -rf /var/lib/apt/lists/* && \
# Create the sclaw user
adduser sclaw
# === INSTALL Playwright MCP + browsers ===
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
# Install MCP globally, then use its bundled Playwright to install Chromium
# This keeps browser versions in sync with the MCP package
RUN npm install -g @playwright/mcp@${PLAYWRIGHT_MCP_VERSION} && \
mkdir /ms-playwright && \
/usr/lib/node_modules/@playwright/mcp/node_modules/.bin/playwright install chromium --with-deps && \
rm -rf /var/lib/apt/lists/* && \
rm -rf ~/.npm/ && \
chmod -R 777 /ms-playwright
# === INSTALL node-lief, Slack SDK, and Gemini CLI ===
RUN npm install -g node-lief @slack/web-api @google/gemini-cli@${GEMINI_CLI_VERSION}
ENV NODE_PATH=/usr/lib/node_modules
# === INSTALL Claude Code (native binary) ===
USER sclaw
WORKDIR /home/sclaw
# Pre-configure Gemini CLI to use API key auth (no interactive prompt)
RUN mkdir -p /home/sclaw/.gemini && \
echo '{"security":{"auth":{"selectedType":"gemini-api-key"}}}' > /home/sclaw/.gemini/settings.json
ENV PATH="/home/sclaw/.local/bin:${PATH}"
ENV DISABLE_AUTOUPDATER=1
ENV BASH_ENV=/home/sclaw/.env
# Auth: set these env vars for cloud deployment (no interactive login needed)
# - CLAUDE_CODE_OAUTH_TOKEN: run `claude setup-token` locally to generate
# - GH_TOKEN: run `gh auth token` locally to print current token
# Bake Claude config into image
COPY --chown=sclaw:sclaw setup/CLAUDE.md /home/sclaw/.claude/CLAUDE.md
COPY --chown=sclaw:sclaw setup/settings.json /home/sclaw/.claude/settings.json
# Install scripts (check-context hook, context bar status line)
RUN mkdir -p /home/sclaw/.claude/scripts && \
curl -sLo /home/sclaw/.claude/scripts/check-context.sh \
https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/scripts/check-context.sh && \
curl -sLo /home/sclaw/.claude/scripts/context-bar.sh \
https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/scripts/context-bar.sh && \
chmod +x /home/sclaw/.claude/scripts/check-context.sh && \
chmod +x /home/sclaw/.claude/scripts/context-bar.sh
RUN curl -fsSL https://claude.ai/install.sh | bash -s -- ${CLAUDE_CODE_VERSION}
# === SETUP Claude Code ===
# Install DX plugin and Playwright MCP server
ARG CLAUDE_CODE_TIPS_VERSION=v0.26.7
RUN claude plugin marketplace add https://github.com/ykdojo/claude-code-tips.git#${CLAUDE_CODE_TIPS_VERSION} && \
claude plugin install dx@ykdojo && \
claude mcp add playwright -- playwright-mcp --headless --browser chromium --no-sandbox
# Skip onboarding so CLAUDE_CODE_OAUTH_TOKEN works in interactive mode
# See: https://github.com/anthropics/claude-code/issues/8938
RUN jq '. + {hasCompletedOnboarding: true, bypassPermissionsModeAccepted: true, autoCompactEnabled: false}' /home/sclaw/.claude.json > /tmp/.claude.json.tmp && \
mv /tmp/.claude.json.tmp /home/sclaw/.claude.json
# Set default model (must be after plugin install which rewrites settings.json)
RUN jq '. + {model: "claude-opus-4-6"}' /home/sclaw/.claude/settings.json > /tmp/settings.json.tmp && \
mv /tmp/settings.json.tmp /home/sclaw/.claude/settings.json
# Shell aliases and shortcuts
COPY --chown=sclaw:sclaw setup/.bashrc /tmp/.bashrc
RUN cat /tmp/.bashrc >> /home/sclaw/.bashrc && rm /tmp/.bashrc
# ttyd wrapper script
COPY --chown=sclaw:sclaw setup/ttyd-wrapper.sh /home/sclaw/ttyd-wrapper.sh
RUN chmod +x /home/sclaw/ttyd-wrapper.sh
# Skills and tools
COPY --chown=sclaw:sclaw setup/skills /home/sclaw/.claude/skills
COPY --chown=sclaw:sclaw setup/tools /home/sclaw/tools
# === PATCH Claude Code ===
RUN mkdir -p /tmp/patches && \
cd /tmp && \
curl -sLO https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/system-prompt/${CLAUDE_CODE_VERSION}/patch-native.sh && \
curl -sLO https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/system-prompt/${CLAUDE_CODE_VERSION}/patch-cli.js && \
curl -sLO https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/system-prompt/${CLAUDE_CODE_VERSION}/native-extract.js && \
curl -sLO https://raw.githubusercontent.com/ykdojo/claude-code-tips/main/system-prompt/${CLAUDE_CODE_VERSION}/native-repack.js && \
curl -sL "https://api.github.com/repos/ykdojo/claude-code-tips/contents/system-prompt/${CLAUDE_CODE_VERSION}/patches" | \
jq -r '.[].download_url' | xargs -I{} curl -sLO --output-dir patches {} && \
chmod +x patch-native.sh && \
./patch-native.sh /home/sclaw/.local/share/claude/versions/${CLAUDE_CODE_VERSION} && \
rm -rf /tmp/patches /tmp/*.sh /tmp/*.js