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