Files
cleverclaude-core/.devcontainer/Dockerfile
T
2025-08-01 18:38:09 -04:00

124 lines
3.5 KiB
Docker

# Development container for Python 3.13 Boilerplate project with Claude Code + MCP servers
FROM python:3.13-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# Essential build tools
build-essential \
gcc \
g++ \
make \
# Development utilities
curl \
wget \
git \
vim \
nano \
jq \
tree \
htop \
unzip \
ca-certificates \
# Shell enhancements
zsh \
# Networking tools
net-tools \
iputils-ping \
# Process management
procps \
# For MCP servers
gnupg \
lsb-release \
software-properties-common \
# Clean up
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20 (required for many MCP servers)
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Go 1.22+ (for building Forgejo MCP if needed)
RUN curl -fsSL https://go.dev/dl/go1.22.10.linux-amd64.tar.gz | tar -xzC /usr/local \
&& ln -s /usr/local/go/bin/go /usr/local/bin/go \
&& ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
# Install Claude Code CLI
RUN curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | sh
# Install uv package manager
RUN pip install --no-cache-dir uv>=0.8.0
# Install development tools globally
RUN pip install --no-cache-dir \
ruff>=0.4.0 \
pyright>=1.1.400 \
pre-commit>=3.8.0 \
nox>=2025.4.22
# Install MCP servers globally
RUN npm install -g \
test-runner-mcp \
@crunchloop/mcp-devcontainers \
kubernetes-mcp-server \
@opentofu/opentofu-mcp-server
# Install Python-based MCP servers
RUN pip install --no-cache-dir \
ruff-mcp-server \
uvx
# Install uvx-based MCP servers
RUN uvx install uv-mcp
# Create non-root user
RUN groupadd --gid 1000 vscode \
&& useradd --uid 1000 --gid vscode --shell /bin/bash --create-home vscode \
&& echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Set up user environment
USER vscode
WORKDIR /workspaces/boilerplate
# Create directories for MCP server configurations and logs
RUN mkdir -p ~/.config/claude-code \
&& mkdir -p ~/.local/bin \
&& mkdir -p ~/.local/share/mcp-logs
# Configure git for the user
RUN git config --global init.defaultBranch main \
&& git config --global pull.rebase false \
&& git config --global user.name "Dev Container User" \
&& git config --global user.email "dev@example.com"
# Install Oh My Zsh for better shell experience
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# Set default shell to zsh
ENV SHELL=/bin/zsh
# Create workspace directories
RUN mkdir -p /workspaces/boilerplate/.venv \
&& mkdir -p /tmp/uv-cache \
&& chown -R vscode:vscode /workspaces/boilerplate \
&& chown -R vscode:vscode /tmp/uv-cache
# Set environment variables
ENV PYTHONPATH=/workspaces/boilerplate/src
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
ENV UV_CACHE_DIR=/tmp/uv-cache
# MCP server environment variables
ENV PATH=$PATH:/usr/local/go/bin:~/.local/bin
ENV NODE_PATH=/usr/local/lib/node_modules
ENV MCP_LOG_DIR=/home/vscode/.local/share/mcp-logs
# Set working directory
WORKDIR /workspaces/boilerplate
# Keep container running
CMD ["sleep", "infinity"]