update devcontainer setup

This commit is contained in:
Nikita Sivukhin
2025-12-22 18:07:46 +04:00
parent 37e8cf176a
commit 286fc6d42c
5 changed files with 137 additions and 58 deletions

View File

@@ -10,32 +10,16 @@ ARG PYTHON_VERSION
ENV TZ="$TZ"
# Install basic development tools and iptables/ipset
# Install build dependencies needed for further installations
RUN apt-get update && apt-get install -y --no-install-recommends \
sqlite3 \
less \
git \
procps \
sudo \
fzf \
zsh \
man-db \
unzip \
gnupg2 \
gh \
iptables \
ipset \
iproute2 \
dnsutils \
aggregate \
jq \
nano \
vim \
wget \
curl \
ca-certificates \
build-essential \
pkg-config \
curl \
gnupg2 \
python${PYTHON_VERSION}-dev \
sudo \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Ensure default node user has access to /usr/local/share
@@ -128,7 +112,6 @@ RUN rustc --version \
&& go version \
&& uv --version
# Install global packages
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
ENV PATH=$PATH:/usr/local/share/npm-global/bin
@@ -140,6 +123,35 @@ ENV SHELL=/bin/zsh
ENV EDITOR=vim
ENV VISUAL=vim
# Switch back to root to install runtime dependencies
USER root
# Install runtime dependencies for final image
RUN apt-get update && apt-get install -y --no-install-recommends \
traceroute \
iputils-ping \
sqlite3 \
less \
git \
procps \
fzf \
zsh \
man-db \
unzip \
gh \
iptables \
ipset \
iproute2 \
dnsutils \
aggregate \
jq \
nano \
vim \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Switch back to node user
USER node
# Default powerline10k theme
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
-p git \
@@ -151,11 +163,3 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
# Install Claude
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}
# Copy and set up firewall script
COPY init-firewall.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/init-firewall.sh && \
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
chmod 0440 /etc/sudoers.d/node-firewall
USER node

View File

@@ -0,0 +1,2 @@
FROM ubuntu/squid:latest
RUN apt-get update && apt-get install -y netcat-openbsd && rm -rf /var/lib/apt/lists/*

View File

@@ -1,18 +1,10 @@
{
"name": "tursodb sandbox",
"build": {
"dockerfile": "Dockerfile",
"args": {
"TZ": "${localEnv:TZ:America/Los_Angeles}",
"CLAUDE_CODE_VERSION": "latest",
"GIT_DELTA_VERSION": "0.18.2",
"ZSH_IN_DOCKER_VERSION": "1.2.0",
"GO_VERSION": "1.24.10",
"RUST_VERSION": "1.88.0",
"PYTHON_VERSION": "3.11"
}
},
"runArgs": ["--cap-add=NET_ADMIN", "--cap-add=NET_RAW"],
"dockerComposeFile": ["docker-compose.yml"],
"service": "tursodb",
"remoteUser": "node",
"workspaceFolder": "/workspace",
"waitFor": "postStartCommand",
"customizations": {
"vscode": {
"extensions": [
@@ -52,19 +44,5 @@
}
}
}
},
"remoteUser": "node",
"mounts": [
"source=claude-code-bashhistory-${devcontainerId},target=/commandhistory,type=volume",
"source=claude-code-config-${devcontainerId},target=/home/node/.claude,type=volume"
],
"containerEnv": {
"NODE_OPTIONS": "--max-old-space-size=4096",
"CLAUDE_CONFIG_DIR": "/home/node/.claude",
"POWERLEVEL9K_DISABLE_GITSTATUS": "true"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/workspace",
"postStartCommand": "sudo /usr/local/bin/init-firewall.sh",
"waitFor": "postStartCommand"
}
}

View File

@@ -0,0 +1,60 @@
version: "3.9"
services:
proxy:
build:
context: .
dockerfile: Dockerfile.squid
networks: [sandbox, egress]
volumes:
- ./squid.conf:/etc/squid/squid.conf:ro
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "3128"]
interval: 1s
timeout: 5s
retries: 10
start_period: 1s
tursodb:
depends_on:
proxy:
condition: service_healthy
build:
context: .
dockerfile: Dockerfile
args:
TZ: ${TZ:-America/Los_Angeles}
CLAUDE_CODE_VERSION: "latest"
GIT_DELTA_VERSION: "0.18.2"
ZSH_IN_DOCKER_VERSION: "1.2.0"
GO_VERSION: "1.24.10"
RUST_VERSION: "1.88.0"
PYTHON_VERSION: "3.11"
environment:
NODE_OPTIONS: "--max-old-space-size=4096"
CLAUDE_CONFIG_DIR: "/home/node/.claude"
POWERLEVEL9K_DISABLE_GITSTATUS: "true"
HTTP_PROXY: "http://proxy:3128"
HTTPS_PROXY: "http://proxy:3128"
ALL_PROXY: "http://proxy:3128"
NO_PROXY: "localhost,127.0.0.1"
networks: [sandbox]
volumes:
- ..:/workspace:delegated
- claude-code-bashhistory:/commandhistory
- claude-code-config:/home/node/.claude
cap_add:
- NET_ADMIN
- NET_RAW
init: true
tty: true
volumes:
claude-code-bashhistory:
claude-code-config:
networks:
sandbox:
internal: true
egress:
driver: bridge

35
.devcontainer/squid.conf Normal file
View File

@@ -0,0 +1,35 @@
http_port 3128
# DNS
dns_v4_first on
# Allowed domains
acl allowed dstdomain \
.pythonhosted.org \
.pypi.org \
.crates.io \
.static.rust-lang.org \
.npmjs.org \
.github.com \
.githubusercontent.com \
.go.dev \
.golang.org \
.anthropic.com \
.openai.com \
.sentry.io \
.statsig.com \
.visualstudio.com \
.windows.net
# Allow HTTPS CONNECT only to allowed domains
acl SSL_ports port 443
acl Safe_ports port 80 443
acl CONNECT method CONNECT
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow allowed
http_access deny all
# Logging
access_log stdio:/var/log/squid/access.log