-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.node
More file actions
61 lines (48 loc) · 1.59 KB
/
Dockerfile.node
File metadata and controls
61 lines (48 loc) · 1.59 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
FROM node:24
ARG CLAUDE_CODE_VERSION=latest
# Install basic development tools
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
procps \
sudo \
vim \
fzf \
zsh \
man-db \
unzip \
gnupg2 \
gh \
jq \
cloc \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Ensure default node user has access to /usr/local/share
RUN mkdir -p /usr/local/share/npm-global \
&& chown -R node:node /usr/local/share
# Ensure default `node` user has access to `sudo`
ARG USERNAME=node
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Persist zsh history
RUN mkdir -p /commandhistory \
&& touch /commandhistory/.zsh_history \
&& chown -R $USERNAME /commandhistory
# Add history settings to .zshrc
RUN echo 'HISTFILE=/commandhistory/.zsh_history' >> /home/$USERNAME/.zshrc \
&& echo 'SAVEHIST=10000' >> /home/$USERNAME/.zshrc \
&& echo 'setopt append_history' >> /home/$USERNAME/.zshrc \
&& chown $USERNAME:$USERNAME /home/$USERNAME/.zshrc
# Set `DEVCONTAINER` environment variable to help with orientation
ENV DEVCONTAINER=true
# Create workspace and config directories and set permissions
RUN mkdir -p /workspace /home/node/.claude \
&& chown -R node:node /workspace /home/node/.claude
WORKDIR /workspace
# Set up non-root user
USER node
# Install global packages
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
ENV PATH=$PATH:/usr/local/share/npm-global/bin
# Set the default shell to zsh rather than sh
ENV SHELL=/bin/zsh
# Install Claude
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}