# iris-3b-turbo-gb10: the same pinned image as the kromoss-dmd2-gb10 capsule (nvcr.io/nvidia/pytorch:25.09-py3 + diffusers 0.41.0), which
# has what gx10's start_iris3b_turbo.sh installed at start (it pip-installed diffusers from
# its main branch; this pins a release that has the pipeline).
#
# Base: nvcr.io/nvidia/pytorch:25.09-py3 (the image gx10's start_moss_image.sh runs on),
# pinned by digest. The pins below are exactly what that script's
# `pip install --upgrade-strategy only-if-needed 'diffusers>=0.38' 'transformers>=5.3' ...`
# resolved to in the working kromoss-dmd2 container (read off `docker diff`).
#
# torchao is removed for the recipe's documented reason: diffusers reaches torchao eagerly
# while importing AutoencoderKLFlux2, and NGC 25.09's torchao 0.13 lacks the FqnToConfig
# newer diffusers expects. Only plain bf16/fp32 weights are loaded here.
FROM nvcr.io/nvidia/pytorch@sha256:f3b4a33fd60d5e0358287bb44d57e91eda45e8f1681fef1bfd6c969371417130
RUN pip install --no-cache-dir \
      diffusers==0.41.0 transformers==5.20.2 tokenizers==0.23.3 accelerate==1.15.0 \
      safetensors==0.8.0 huggingface_hub==1.33.0 hf_xet==1.7.0 pillow==13.0.0 \
      fastapi==0.161.0 starlette==1.9.0 uvicorn==0.54.0 \
 && pip uninstall -y torchao \
 && python3 -c "from diffusers import AutoencoderKLFlux2; import transformers; print('ok', transformers.__version__)"

# Iris-3B's own code (speridlabs/iris-3b, Apache-2.0) at the commit gx10 pins (cee0c13), as a
# sha256-checked tarball unpacked to /opt/iris3b (the server puts /opt/iris3b/src on sys.path),
# plus omegaconf, the one dependency of gx10's install list this base lacks.
RUN python3 -c "import urllib.request as u; u.urlretrieve('https://github.com/speridlabs/iris-3b/archive/cee0c130a62a9c288ad8918f1f7cdf23cc228d69.tar.gz', '/tmp/iris.tgz')" \
 && echo '4a623b75fa80956cc112bca52f3701bc1c166259da76a706a172b1fb3b25dbb6  /tmp/iris.tgz' | sha256sum -c - \
 && mkdir -p /opt/iris3b && tar xzf /tmp/iris.tgz -C /opt/iris3b --strip-components=1 && rm /tmp/iris.tgz \
 && pip install --no-cache-dir --no-deps omegaconf==2.3.1 antlr4-python3-runtime==4.9.3
