FROM python:3.11-slim

# ------------------------------------------------------------
# System config
# ------------------------------------------------------------
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# ------------------------------------------------------------
# OS dependencies
# ------------------------------------------------------------
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    ca-certificates \
    curl \
    git \
    pkg-config \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender1 \
    sqlite3 \
    && rm -rf /var/lib/apt/lists/*

# ------------------------------------------------------------
# Python packaging baseline
# ------------------------------------------------------------
RUN pip install --no-cache-dir --upgrade pip wheel setuptools

# ------------------------------------------------------------
# Core scientific + ML stack (CPU only)
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    numpy \
    scipy \
    pandas \
    scikit-learn \
    scikit-image \
    statsmodels \
    joblib \
    cloudpickle \
    sympy \
    numba \
    llvmlite

# ------------------------------------------------------------
# ML runtimes
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    torch==2.9.1+cpu \
    torchvision==0.24.1 \
    --extra-index-url https://download.pytorch.org/whl/cpu

RUN pip install --no-cache-dir \
    onnx \
    onnxruntime \
    tflite-runtime \
    keras

# ------------------------------------------------------------
# Signal processing + estimation
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    PyWavelets \
    filterpy

# ------------------------------------------------------------
# Vision & imaging
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    pillow \
    opencv-python-headless \
    imageio \
    tifffile

# ------------------------------------------------------------
# Data, formats, compression
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    pyarrow \
    duckdb \
    lz4 \
    zstandard \
    msgpack \
    orjson \
    csvkit \
    openpyxl \
    xlrd

# ------------------------------------------------------------
# Databases & storage
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    sqlalchemy \
    tinydb

# ------------------------------------------------------------
# Time, scheduling, system
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    python-dateutil \
    pytz \
    tzdata \
    schedule \
    psutil

# ------------------------------------------------------------
# Space / orbital mechanics
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    sgp4 \
    pyorbital \
    pyproj

# ------------------------------------------------------------
# Networking & APIs (useful but optional in flight)
# ------------------------------------------------------------
RUN pip install --no-cache-dir \
    requests \
    httpx \
    fastapi \
    uvicorn \
    pydantic \
    rich \
    loguru

# ------------------------------------------------------------
# Default command
# ------------------------------------------------------------
WORKDIR /workspace
CMD ["python"]