spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / .devcontainer / Dockerfile
84 lines · 2.2 KBRaw
1FROM node:20
2
3ARG TZ
4ENV TZ="$TZ"
5
6# Install basic development tools and iptables/ipset
7RUN apt update && apt install -y less \
8 git \
9 procps \
10 sudo \
11 fzf \
12 zsh \
13 man-db \
14 unzip \
15 gnupg2 \
16 gh \
17 iptables \
18 ipset \
19 iproute2 \
20 dnsutils \
21 aggregate \
22 jq \
23 nano \
24 vim
25
26# Ensure default node user has access to /usr/local/share
27RUN mkdir -p /usr/local/share/npm-global && \
28 chown -R node:node /usr/local/share
29
30ARG USERNAME=node
31
32# Persist bash history.
33RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
34 && mkdir /commandhistory \
35 && touch /commandhistory/.bash_history \
36 && chown -R $USERNAME /commandhistory
37
38# Set `DEVCONTAINER` environment variable to help with orientation
39ENV DEVCONTAINER=true
40
41# Create workspace and config directories and set permissions
42RUN mkdir -p /workspace /home/node/.claude && \
43 chown -R node:node /workspace /home/node/.claude
44
45WORKDIR /workspace
46
47RUN ARCH=$(dpkg --print-architecture) && \
48 wget "https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_${ARCH}.deb" && \
49 sudo dpkg -i "git-delta_0.18.2_${ARCH}.deb" && \
50 rm "git-delta_0.18.2_${ARCH}.deb"
51
52# Set up non-root user
53USER node
54
55# Install global packages
56ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
57ENV PATH=$PATH:/usr/local/share/npm-global/bin
58
59# Set the default shell to zsh rather than sh
60ENV SHELL=/bin/zsh
61
62# Set the default editor and visual
63ENV EDITOR nano
64ENV VISUAL nano
65
66# Default powerline10k theme
67RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
68 -p git \
69 -p fzf \
70 -a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
71 -a "source /usr/share/doc/fzf/examples/completion.zsh" \
72 -a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
73 -x
74
75# Install Claude
76RUN npm install -g @anthropic-ai/claude-code
77
78# Copy and set up firewall script
79COPY init-firewall.sh /usr/local/bin/
80USER root
81RUN chmod +x /usr/local/bin/init-firewall.sh && \
82 echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
83 chmod 0440 /etc/sudoers.d/node-firewall
84USER node