# MCP Sandbox Clean Image
# Build: su - $HOST_USER -c 'podman build -t localhost/sandbox-image:clean -f Containerfile .'

FROM docker.io/library/debian:trixie-slim

# Environment variables
ENV LANG=C.UTF-8 \
    PATH="/root/.cargo/bin:/usr/local/go/bin:/usr/local/cuda/bin:${PATH}"

# Install base packages (exact order from sandbox.yaml)
RUN apt update && apt install -y \
    openssh-server \
    file \
    sudo \
    git \
    gh \
    build-essential \
    cmake ccache clang-format \
    python3 python3-pip \
    curl wget \
    nano vim \
    zip unzip p7zip-full \
    tree jq \
    ripgrep \
    figlet \
    gnupg2 \
    glslc \
    libssl-dev \
    libvulkan-dev \
    spirv-headers

# Install CUDA Toolkit via NVIDIA repo
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/debian13/x86_64/8793F200.pub | gpg --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian13/x86_64/ /" > /etc/apt/sources.list.d/cuda-debian13-x86_64.list \
    && apt update \
    && apt install -y cuda-toolkit-13-1

# Install Node.js 24.x
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
RUN apt install -y nodejs

# Install Rust (stable)
RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Install Go 1.25.4
RUN curl -sSL https://go.dev/dl/go1.25.4.linux-amd64.tar.gz | tar -C /usr/local -xz

# Upgrade to current package state and prime the apt lists cache
RUN apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade \
    && apt-get clean \
    && apt-get update

# Configure SSH
RUN echo "root:sandbox" | chpasswd \
    && sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/" /etc/ssh/sshd_config \
    && sed -i 's/^AcceptEnv LANG LC_\*/#AcceptEnv LANG LC_*/' /etc/ssh/sshd_config \
    && mkdir -p /run/sshd

# Locale for interactive SSH sessions (pam_env)
RUN echo "LANG=C.UTF-8" > /etc/environment

# Create mount points
RUN mkdir -p /mnt/inputs /mnt/workspace /mnt/outputs

# Working directory
WORKDIR /mnt/workspace

# Default command
CMD ["/usr/sbin/sshd", "-D"]
