-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
103 lines (86 loc) · 2.84 KB
/
Copy pathDockerfile
File metadata and controls
103 lines (86 loc) · 2.84 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
FROM node:24-slim
ARG TZ=UTC
ENV TZ="$TZ"
# Install development tools + firewall utilities
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openssh-client \
less \
git \
procps \
sudo \
fzf \
zsh \
man-db \
unzip \
gnupg2 \
gh \
iptables \
ipset \
iproute2 \
dnsutils \
aggregate \
jq \
nano \
vim \
wget \
curl \
python3 \
python3-pip \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Ensure node user has access to /usr/local/share
RUN chown -R node:node /usr/local/share
ARG USERNAME=node
# Persist shell history
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" && \
mkdir /commandhistory && \
touch /commandhistory/.bash_history && \
chown -R $USERNAME /commandhistory
# Signal we are inside a container
ENV DEVCONTAINER=true
# Create workspace and config dirs
RUN mkdir -p /workspace /home/node/.claude && \
chown -R node:node /workspace /home/node/.claude
WORKDIR /workspace
# Install git-delta for nicer diffs
ARG GIT_DELTA_VERSION=0.18.2
RUN ARCH=$(dpkg --print-architecture) && \
wget -q "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
dpkg -i "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
rm "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb"
# Switch to non-root user for user-level setup
USER node
# Add Claude Code to PATH (native installer puts it here)
ENV PATH=$PATH:/home/node/.local/bin
ENV SHELL=/bin/zsh
ENV EDITOR=vim
ENV VISUAL=vim
ENV NODE_OPTIONS="--max-old-space-size=4096"
ENV CLAUDE_CONFIG_DIR=/home/node/.claude
# Install zsh with Powerline10k theme
ARG ZSH_IN_DOCKER_VERSION=1.2.0
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/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
# Enable pnpm and yarn via corepack (requires root for global symlinks!)
USER root
RUN corepack enable && \
corepack prepare pnpm@latest --activate && \
corepack prepare yarn@stable --activate
USER node
# Install Claude Code using native installer
RUN curl -fsSL https://claude.ai/install.sh | bash
# Set up firewall script (requires root/sudo) and SSH init script (runs as node)
COPY init-firewall.sh init-ssh.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/init-firewall.sh /usr/local/bin/init-ssh.sh && \
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
chmod 0440 /etc/sudoers.d/node-firewall
USER node
CMD ["/bin/zsh"]