FROM python:3.11-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    bash \
    coreutils \
    && rm -rf /var/lib/apt/lists/*

# Install common Python packages for data analysis and computation
RUN pip install --no-cache-dir \
    numpy \
    pandas \
    requests \
    matplotlib \
    scipy

# Create non-root user for security
RUN useradd -m -u 1000 sandbox

# Create execution directory
RUN mkdir /executions && chown sandbox:sandbox /executions

# Switch to non-root user
USER sandbox

# Set working directory
WORKDIR /executions

# Keep container running
CMD ["tail", "-f", "/dev/null"]
