# Shared base image for the Applied AI Security lab pack.
# Provides the full Python stack + JupyterLab + the common/ library.
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    AAIS_DATA_DIR=/work/data

WORKDIR /work

# System libs needed by pillow / matplotlib / torch.
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential git curl libgl1 libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Install CPU-only torch wheels first (smaller, no CUDA).
COPY requirements.txt .
RUN pip install --index-url https://download.pytorch.org/whl/cpu torch==2.5.1 torchvision==0.20.1 \
    && pip install -r requirements.txt

# The lab content is bind-mounted by docker compose, so we don't COPY it here.
EXPOSE 8888 8000

# No token/password (local teaching use) so http://localhost:8888 opens straight in.
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", \
     "--allow-root", "--ServerApp.root_dir=/work", \
     "--IdentityProvider.token=", "--IdentityProvider.password="]
