FROM python:3.11-slim-bookworm  

# Install system dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    git \
    build-essential \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Create virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Install PyTorch first (specific versions matching reference YAML)
RUN pip install --no-cache-dir \
    torch==2.1.2 \
    torchvision==0.16.2 \
    torchaudio

# Install numpy (specific version)
RUN pip install --no-cache-dir numpy==1.26

# Install core dependencies
RUN pip install --no-cache-dir \
    opencv-python>=4.8.0 \
    timm==0.9.12 \
    scipy>=1.11.0 \
    gdown>=5.2.0 \
    transformers \
    torchsde \
    setuptools>=65.5.1 \
    bitsandbytes \
    yapf==0.40.1 \
    ml_collections \
    hydra-core \
    pandas>=2.0.0 \
    omegaconf \
    wandb \
    pyarrow \
    h5py \
    einops \
    tensordict \
    torchrl \
    imageio \
    matplotlib \
    scikit-learn \
    pytest \
    fastparquet \
    jax \
    flax


COPY app/ /app/
WORKDIR /app
