@@ -8,10 +8,12 @@ Codegen sandboxes are built on a custom Docker image that provides a comprehensi
88
99- ** Python 3.13** (via ` ghcr.io/astral-sh/uv:python3.13-bookworm ` )
1010- ** Node.js 22.14.0** (managed via NVM)
11- - ** Essential development tools** : git, curl, ripgrep, fd-find, gh (GitHub CLI)
11+ - ** Essential development tools** : git, curl, ripgrep, fd-find, gh (GitHub CLI), tree
1212- ** Package managers** : uv, npm, yarn, pnpm
1313- ** Editors** : nano, vim
1414- ** System utilities** : tmux, supervisor, nginx
15+ - ** Security tools** : semgrep, trufflehog (via Homebrew)
16+ - ** Additional tools** : Homebrew, code-server, uvicorn
1517
1618## Dockerfile
1719
@@ -27,9 +29,11 @@ ENV NVM_DIR=/usr/local/nvm \
2729 PYTHONUNBUFFERED=1 \
2830 COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
2931 PYTHONPATH="/usr/local/lib/python3.13/site-packages" \
30- IS_SANDBOX=True
32+ IS_SANDBOX=True \
33+ USER=linuxbrew \
34+ HOMEBREW_NO_AUTO_UPDATE=1
3135
32- ENV PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin:/usr/local/nvm:/usr/local/bin:$PATH
36+ ENV PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin:/usr/local/nvm:/usr/local/bin:/root/.local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin: $PATH
3337
3438ARG INVALIDATE_FILES_LAYER=1
3539# Copy configuration files and set permissions
@@ -42,6 +46,7 @@ COPY setup_ssh_keys.sh /usr/local/bin/setup_ssh_keys.sh
4246COPY nginx.conf /etc/nginx/nginx.conf
4347COPY error.html /usr/share/nginx/html/error.html
4448COPY tmux_output_script.sh /usr/local/bin/tmux_output_script.sh
49+ COPY pre-push.sh /root/.git-templates/hooks/pre-push
4550
4651# Install dependencies and set up environment in a single layer
4752RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
@@ -51,6 +56,7 @@ RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
5156 gh \
5257 lsof \
5358 ripgrep \
59+ tree \
5460 openssh-server \
5561 nginx-full \
5662 fcgiwrap \
@@ -59,6 +65,8 @@ RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
5965 vim \
6066 supervisor \
6167 netcat-openbsd \
68+ sudo \
69+ && apt-get clean && rm -rf /var/lib/apt/lists/* \
6270 && rm -rf /var/lib/apt/lists/* \
6371 && mkdir -p -m 755 /etc/apt/keyrings \
6472 && wget -nv -O- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
@@ -67,7 +75,7 @@ RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
6775 # Set up environment variables and save it to /etc/profile.d/nvm.sh
6876 && echo "export NVM_DIR=\" $NVM_DIR\" " >> /etc/profile.d/nvm.sh \
6977 && echo "[ -s \" $NVM_DIR/nvm.sh\" ] && \. \" $NVM_DIR/nvm.sh\" " >> /etc/profile.d/nvm.sh \
70- && echo "export PATH=\" $NVM_DIR/versions/node/$NODE_VERSION/bin:\$ PATH\" " >> /etc/profile.d/nvm.sh \
78+ && echo "export PATH=\" $NVM_DIR/versions/node/$NODE_VERSION/bin:/usr/local/nvm:/usr/local/bin:/root/.local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin: \$ PATH\" " >> /etc/profile.d/nvm.sh \
7179 && echo "export NVM_BIN=\" $NVM_DIR/versions/node/$NODE_VERSION/bin\" " >> /etc/profile.d/nvm.sh \
7280 && echo "export NODE_VERSION=\" $NODE_VERSION\" " >> /etc/profile.d/nvm.sh \
7381 && echo "export NODE_OPTIONS=\" --max-old-space-size=8192\" " >> /etc/profile.d/nvm.sh \
@@ -82,6 +90,9 @@ RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
8290 && chmod +x /etc/profile.d/nvm.sh \
8391 # Run the SSH setup script
8492 && /usr/local/bin/setup_ssh_user.sh \
93+ # Setup global pre-push git hook for semgrep secret scan
94+ && chmod +x /root/.git-templates/hooks/pre-push \
95+ && git config --global init.templateDir /root/.git-templates \
8596 # Install nvm, Node.js, and code-server
8697 && mkdir -p $NVM_DIR \
8798 && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
@@ -93,7 +104,23 @@ RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" \
93104 && corepack prepare yarn@stable --activate \
94105 && corepack prepare pnpm@latest --activate \
95106 && curl -fsSL https://raw.githubusercontent.com/coder/code-server/refs/tags/v4.99.1/install.sh | sh \
96- && uv tool install uvicorn[standard]
107+ && uv tool install uvicorn[standard] \
108+ && pip install semgrep \
109+ && git clone https://github.com/Homebrew/brew /home/linuxbrew/.linuxbrew/Homebrew \
110+ && mkdir /home/linuxbrew/.linuxbrew/bin \
111+ && ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/brew
112+
113+ # Ensure correct permissions
114+ RUN useradd -m -s /bin/bash $USER && \
115+ chown -R $USER:$USER /home/linuxbrew
116+
117+ WORKDIR /home/linuxbrew
118+
119+ # Initialize Homebrew environment and install gitleaks
120+ RUN eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \
121+ && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/linuxbrew/.bashrc \
122+ && chown -R $USER:$USER /home/linuxbrew/.bashrc \
123+ && su - $USER -c 'brew install trufflehog'
97124
98125ENTRYPOINT ["/usr/local/bin/start.sh" ]
99126```
@@ -108,6 +135,7 @@ Essential development tools are pre-installed, including:
108135- ** Git** for version control
109136- ** GitHub CLI** for GitHub integration
110137- ** ripgrep** and ** fd-find** for fast file searching
138+ - ** tree** for directory visualization
111139- ** tmux** for terminal multiplexing
112140- ** nginx** for web server capabilities
113141
@@ -116,6 +144,17 @@ Multiple package managers are available:
116144- ** uv** for Python package management
117145- ** npm** , ** yarn** , and ** pnpm** for Node.js packages
118146- ** corepack** for managing package manager versions
147+ - ** Homebrew** for additional system packages
148+
149+ ### Security Features
150+ The image includes security scanning tools:
151+ - ** semgrep** for static analysis and secret detection
152+ - ** trufflehog** for credential scanning (installed via Homebrew)
153+ - ** Pre-push git hooks** for automated security checks
119154
120155### SSH and Remote Access
121- The image includes SSH server configuration for remote access and development, with proper user setup and key management.
156+ The image includes SSH server configuration for remote access and development, with proper user setup and key management.
157+
158+ ### Code Server Integration
159+ ** code-server** is pre-installed, enabling VS Code-like editing capabilities directly in the browser for enhanced development experience.
160+
0 commit comments