Claude
Skills
Sign in
Back

sandbox-templates

Included with Lifetime
$97 forever

Use this skill when setting up Docker sandbox environments for courses. Provides language-specific Dockerfile templates with compilers, linters, debuggers, and test frameworks. Trigger phrases include "sandbox template", "Dockerfile", "setup sandbox", "create container", "development environment".

Cloud & DevOps

What this skill does


# Sandbox Templates - Language-Specific Docker Configurations

Pre-configured Dockerfile templates for different programming languages with all necessary tools for compiling, testing, linting, and debugging course code.

## Template Selection

Choose the appropriate template based on the course's primary language:

| Language | Template | Base Image | Size |
|----------|----------|------------|------|
| C++ | `cpp-sandbox` | Ubuntu 24.04 | ~1.5GB |
| Rust | `rust-sandbox` | Rust Official | ~1.2GB |
| Python | `python-sandbox` | Python 3.12 | ~800MB |
| Go | `go-sandbox` | Go Official | ~900MB |
| C | `c-sandbox` | Ubuntu 24.04 | ~1.2GB |
| Multi-language | `multi-sandbox` | Ubuntu 24.04 | ~2.5GB |

---

## C++ Sandbox Template

For C++ courses (C++17/20/23 support).

### Dockerfile
```dockerfile
# C++ Development Sandbox
# Supports: C++17, C++20, C++23 (partial)
# Tools: GCC 13, Clang 17, CMake, GDB, Valgrind, clang-tidy, cppcheck

FROM ubuntu:24.04

LABEL maintainer="course-builder"
LABEL description="C++ development sandbox for course materials"

# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

# Install compilers and build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
    # Compilers
    g++-13 \
    gcc-13 \
    clang-17 \
    clang++-17 \
    # Build tools
    cmake \
    ninja-build \
    make \
    # Debugging
    gdb \
    lldb-17 \
    valgrind \
    # Linting
    clang-tidy-17 \
    clang-format-17 \
    cppcheck \
    # Testing frameworks
    libgtest-dev \
    libgmock-dev \
    catch2 \
    # Utilities
    git \
    curl \
    wget \
    unzip \
    pkg-config \
    # Cleanup
    && rm -rf /var/lib/apt/lists/*

# Set up alternatives for gcc/g++
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 \
    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 \
    && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100 \
    && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100 \
    && update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-17 100 \
    && update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100

# Build and install Google Test (if not available as package)
RUN cd /usr/src/gtest && cmake . && make && cp lib/*.a /usr/lib/

# Create non-root user for safety
RUN useradd -m -s /bin/bash sandbox
USER sandbox

WORKDIR /workspace

# Default command keeps container running
CMD ["tail", "-f", "/dev/null"]
```

### Common Commands
```bash
# Compile with GCC (C++20)
g++ -std=c++20 -Wall -Wextra -Werror -o /tmp/prog source.cpp

# Compile with Clang (C++20)
clang++ -std=c++20 -Wall -Wextra -Werror -o /tmp/prog source.cpp

# Compile with sanitizers
g++ -std=c++20 -fsanitize=address,undefined -g -o /tmp/prog source.cpp

# Run clang-tidy
clang-tidy source.cpp -- -std=c++20

# Run cppcheck
cppcheck --enable=all --std=c++20 source.cpp

# Debug with GDB
gdb /tmp/prog

# Memory check with Valgrind
valgrind --leak-check=full /tmp/prog

# CMake build
cmake -B build -G Ninja && cmake --build build

# Run tests
ctest --test-dir build --output-on-failure
```

---

## Rust Sandbox Template

For Rust courses (stable and nightly support).

### Dockerfile
```dockerfile
# Rust Development Sandbox
# Supports: Stable, Beta, Nightly Rust
# Tools: rustc, cargo, clippy, rustfmt, rust-analyzer, miri

FROM rust:1.83-bookworm

LABEL maintainer="course-builder"
LABEL description="Rust development sandbox for course materials"

# Install additional toolchains
RUN rustup component add \
    clippy \
    rustfmt \
    rust-src \
    rust-analyzer

# Install nightly for miri and advanced features
RUN rustup toolchain install nightly \
    && rustup component add --toolchain nightly miri rust-src

# Install useful cargo extensions
RUN cargo install \
    cargo-watch \
    cargo-expand \
    cargo-audit \
    cargo-outdated \
    cargo-tarpaulin

# Install system dependencies for common crates
RUN apt-get update && apt-get install -y --no-install-recommends \
    pkg-config \
    libssl-dev \
    gdb \
    lldb \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -s /bin/bash sandbox
USER sandbox

# Set up cargo home for non-root user
ENV CARGO_HOME=/home/sandbox/.cargo
ENV PATH="${CARGO_HOME}/bin:${PATH}"

WORKDIR /workspace

CMD ["tail", "-f", "/dev/null"]
```

### Common Commands
```bash
# Compile single file
rustc -o /tmp/prog source.rs

# Build with cargo
cargo build

# Build release
cargo build --release

# Run
cargo run

# Run tests
cargo test

# Run specific test
cargo test test_name

# Lint with clippy
cargo clippy -- -D warnings

# Format code
cargo fmt

# Check without building
cargo check

# Expand macros
cargo expand

# Run with miri (memory safety)
cargo +nightly miri run

# Run tests with miri
cargo +nightly miri test

# Security audit
cargo audit

# Test coverage
cargo tarpaulin
```

---

## Python Sandbox Template

For Python courses (3.12+ with type checking and testing tools).

### Dockerfile
```dockerfile
# Python Development Sandbox
# Supports: Python 3.12
# Tools: pytest, mypy, ruff, black, coverage, ipython

FROM python:3.12-slim-bookworm

LABEL maintainer="course-builder"
LABEL description="Python development sandbox for course materials"

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Install Python development tools
RUN pip install --no-cache-dir \
    # Testing
    pytest \
    pytest-cov \
    pytest-xdist \
    pytest-mock \
    hypothesis \
    # Type checking
    mypy \
    # Linting and formatting
    ruff \
    black \
    isort \
    # Interactive
    ipython \
    # Documentation
    pdoc \
    # Debugging
    pdbpp \
    # Utilities
    rich \
    typer

# Create non-root user
RUN useradd -m -s /bin/bash sandbox
USER sandbox

WORKDIR /workspace

# Set Python to unbuffered mode
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

CMD ["tail", "-f", "/dev/null"]
```

### Common Commands
```bash
# Run script
python3 script.py

# Run with unbuffered output
python3 -u script.py

# Run module
python3 -m module_name

# Run tests
python3 -m pytest -v

# Run tests with coverage
python3 -m pytest --cov=. --cov-report=term-missing

# Run parallel tests
python3 -m pytest -n auto

# Type check
mypy script.py

# Type check strict
mypy --strict script.py

# Lint with ruff
ruff check .

# Fix linting issues
ruff check --fix .

# Format with black
black script.py

# Check formatting
black --check script.py

# Sort imports
isort script.py

# Interactive REPL
ipython
```

---

## Go Sandbox Template

For Go courses (latest stable version).

### Dockerfile
```dockerfile
# Go Development Sandbox
# Supports: Go 1.23+
# Tools: go, gofmt, golint, staticcheck, delve

FROM golang:1.23-bookworm

LABEL maintainer="course-builder"
LABEL description="Go development sandbox for course materials"

# Install additional tools
RUN go install golang.org/x/lint/golint@latest \
    && go install honnef.co/go/tools/cmd/staticcheck@latest \
    && go install github.com/go-delve/delve/cmd/dlv@latest \
    && go install golang.org/x/tools/cmd/goimports@latest \
    && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    gdb \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -s /bin/bash sandbox
USER sandbox

# Set up Go paths for non-root user
ENV GOPATH=/home/sandbox/go
ENV PATH="${GOPATH}/bin:${PATH}"

WORKDIR /workspace

CMD ["tail", "-f", "/dev/null"]
```

### Common Commands
```bash
# Run single file
go run main.go

# Build
go build -o /tmp/prog .

# Build with race detection
go build -race -o /tmp/prog .

# Run tests
go test ./...

# Run tests verbose
go test -v ./...

# Run tests with coverage
go

Related in Cloud & DevOps