FROM debian:13.3

# Install system dependencies
RUN apt-get update && apt-get install -y wget libgl1 libglib2.0-0 patchelf git

# Copy project files
COPY ./src /src

# Create a non-root user
RUN useradd -m student
RUN chown -R student:student /src
USER student

# Install uv
RUN wget -qO- https://astral.sh/uv/install.sh | sh
ENV PATH="/home/student/.local/bin:$PATH"

# Create main env for Jupyter Notebook
WORKDIR /src
RUN uv venv --python 3.11
ENV PATH="/src/.venv/bin:$PATH"
ENV IRIS_ENV="DEV"
RUN uv pip install notebook git+https://github.com/worldcoin/open-iris.git@v1.11.0
RUN patchelf --clear-execstack /src/.venv/lib/python3.11/site-packages/onnxruntime/capi/*.so

# Run initialize to download the model
RUN python ./initialize.py

# Launch Jupyter Notebook
EXPOSE 8888
CMD ["python", "-m", "jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--IdentityProvider.token=''"]