forked from trailofbits/claude-code-devcontainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
135 lines (113 loc) · 5.09 KB
/
Copy pathDockerfile
File metadata and controls
135 lines (113 loc) · 5.09 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Claude Code Devcontainer
# Based on Microsoft devcontainer image for better devcontainer integration
FROM ghcr.io/astral-sh/uv:0.10@sha256:10902f58a1606787602f303954cea099626a4adb02acbac4c69920fe9d278f82 AS uv
FROM mcr.microsoft.com/devcontainers/base:ubuntu24.04@sha256:4bcb1b466771b1ba1ea110e2a27daea2f6093f9527fb75ee59703ec89b5561cb
ARG TZ
ENV TZ="$TZ"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install additional system packages (base image already includes git, curl, sudo, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
# Sandboxing support for Claude Code
bubblewrap \
socat \
# Modern CLI tools
fd-find \
ripgrep \
tmux \
zsh \
# Build tools
build-essential \
# Utilities
jq \
nano \
unzip \
vim \
# Network tools (for security testing)
dnsutils \
ipset \
iptables \
iproute2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install git-delta
# renovate: datasource=github-releases depName=dandavison/delta
ARG GIT_DELTA_VERSION=0.18.2
RUN ARCH=$(dpkg --print-architecture) && \
curl -fsSL "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" -o /tmp/git-delta.deb && \
dpkg -i /tmp/git-delta.deb && \
rm /tmp/git-delta.deb
# Install uv (Python package manager) via multi-stage copy
COPY --from=uv /uv /usr/local/bin/uv
# Install fzf from GitHub releases (newer than apt, includes built-in shell integration)
# renovate: datasource=github-releases depName=junegunn/fzf
ARG FZF_VERSION=0.70.0
RUN ARCH=$(dpkg --print-architecture) && \
case "${ARCH}" in \
amd64) FZF_ARCH="linux_amd64" ;; \
arm64) FZF_ARCH="linux_arm64" ;; \
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
esac && \
curl -fsSL "https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-${FZF_ARCH}.tar.gz" | tar -xz -C /usr/local/bin
# Create directories and set ownership (combined for fewer layers)
RUN mkdir -p /commandhistory /workspace /home/vscode/.claude /opt && \
touch /commandhistory/.bash_history && \
touch /commandhistory/.zsh_history && \
chown -R vscode:vscode /commandhistory /workspace /home/vscode/.claude /opt
# Set environment variables
ENV DEVCONTAINER=true
ENV SHELL=/bin/zsh
ENV EDITOR=nano
ENV VISUAL=nano
WORKDIR /workspace
# Switch to non-root user for remaining setup
USER vscode
# Set PATH early so claude and other user-installed binaries are available
ENV PATH="/home/vscode/.local/bin:$PATH"
# Install Claude Code natively with marketplace plugins
RUN curl -fsSL https://claude.ai/install.sh | bash && \
claude plugin marketplace add anthropics/skills && \
claude plugin marketplace add trailofbits/skills && \
claude plugin marketplace add trailofbits/skills-curated && \
claude plugin marketplace add https://github.com/wilhide/ed3d-plugins.git && \
claude plugin install ed3d-00-getting-started@ed3d-plugins && \
claude plugin install ed3d-plan-and-execute@ed3d-plugins && \
claude plugin install ed3d-house-style@ed3d-plugins && \
claude plugin install ed3d-basic-agents@ed3d-plugins && \
claude plugin install ed3d-research-agents@ed3d-plugins && \
claude plugin install ed3d-extending-claude@ed3d-plugins && \
claude plugin install ed3d-playwright@ed3d-plugins && \
claude plugin install ed3d-hook-skill-reinforcement@ed3d-plugins && \
claude plugin install ed3d-hook-claudemd-reminder@ed3d-plugins
# Install Python 3.13 via uv (fast binary download, not source compilation)
RUN uv python install 3.14 --default
# Install codex
RUN curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh
# Install ast-grep (AST-based code search)
RUN uv tool install ast-grep-cli
# Install fnm (Fast Node Manager) and Node 22
ARG NODE_VERSION=22
ENV FNM_DIR="/home/vscode/.fnm"
RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "$FNM_DIR" --skip-shell && \
export PATH="$FNM_DIR:$PATH" && \
eval "$(fnm env)" && \
fnm install ${NODE_VERSION} && \
fnm default ${NODE_VERSION}
# Install Rust via rustup (unattended); PATH is set via ENV instead of rustup's
# shell-profile edits so cargo works in non-login shells too
RUN curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path
ENV PATH="/home/vscode/.cargo/bin:$PATH"
# Install Oh My Zsh
# renovate: datasource=github-releases depName=deluan/zsh-in-docker
ARG ZSH_IN_DOCKER_VERSION=1.2.1
RUN sh -c "$(curl -fsSL https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
-p git \
-x
# Copy zsh configuration
COPY --chown=vscode:vscode .zshrc /home/vscode/.zshrc.custom
# Append custom zshrc to the main one
RUN echo 'source ~/.zshrc.custom' >> /home/vscode/.zshrc
# Copy post_install script
COPY --chown=vscode:vscode post_install.py /opt/post_install.py
# NOTE: Do not create files under /workspace here. The devcontainer bind-mounts
# the host project over /workspace at runtime (see workspaceMount in
# devcontainer.json), which shadows anything baked into the image at that path.
# Workspace staging (e.g. .ed3d/) happens in post_install.py via postCreateCommand.