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