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
| 1 | FROM node:20 |
| 2 | |
| 3 | ARG TZ |
| 4 | ENV TZ="$TZ" |
| 5 | |
| 6 | ARG CLAUDE_CODE_VERSION=latest |
| 7 | |
| 8 | # Install basic development tools and iptables/ipset |
| 9 | RUN 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 |
| 31 | RUN mkdir -p /usr/local/share/npm-global && \ |
| 32 | chown -R node:node /usr/local/share |
| 33 | |
| 34 | ARG USERNAME=node |
| 35 | |
| 36 | # Persist bash history. |
| 37 | RUN 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 |
| 43 | ENV DEVCONTAINER=true |
| 44 | |
| 45 | # Create workspace and config directories and set permissions |
| 46 | RUN mkdir -p /workspace /home/node/.claude && \ |
| 47 | chown -R node:node /workspace /home/node/.claude |
| 48 | |
| 49 | WORKDIR /workspace |
| 50 | |
| 51 | ARG GIT_DELTA_VERSION=0.18.2 |
| 52 | RUN 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 |
| 58 | USER node |
| 59 | |
| 60 | # Install global packages |
| 61 | ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global |
| 62 | ENV PATH=$PATH:/usr/local/share/npm-global/bin |
| 63 | |
| 64 | # Set the default shell to zsh rather than sh |
| 65 | ENV SHELL=/bin/zsh |
| 66 | |
| 67 | # Set the default editor and visual |
| 68 | ENV EDITOR=nano |
| 69 | ENV VISUAL=nano |
| 70 | |
| 71 | # Default powerlevel10k theme |
| 72 | ARG ZSH_IN_DOCKER_VERSION=1.2.0 |
| 73 | RUN 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 |
| 82 | RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION} |
| 83 | |
| 84 | |
| 85 | # Copy and set up firewall script |
| 86 | COPY init-firewall.sh /usr/local/bin/ |
| 87 | USER root |
| 88 | RUN 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 |
| 91 | USER node |