FROM python:3.10-slim WORKDIR /app # Install system deps (libgl1-mesa-glx removed in Debian Trixie — libglib2.0-0 is all Pillow needs) RUN apt-get update && apt-get install -y --no-install-recommends \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Install Python deps — CPU-only torch to keep image lean COPY requirements.txt . RUN pip install --no-cache-dir \ --extra-index-url https://download.pytorch.org/whl/cpu \ -r requirements.txt # Pre-cache model weights at build time using huggingface-cli so cold starts # are near-zero. Separate RUN layers give per-model Docker cache granularity — # changing one model default invalidates only that layer. # HF_HOME is set explicitly so the CLI download and the transformers runtime # both resolve to the same cache directory. ENV HF_HOME=/root/.cache/huggingface RUN huggingface-cli download OwensLab/commfor-model-224 # Pre-cache the timm ViT-S/16 backbone used by Community-Forensics (no pretrained weights needed, just the arch) RUN python3 -c "import timm; timm.create_model('vit_small_patch16_224.augreg_in21k_ft_in1k', pretrained=False)" 2>/dev/null || true RUN huggingface-cli download haywoodsloan/ai-image-detector-deploy RUN huggingface-cli download Ateeqq/ai-vs-human-image-detector RUN huggingface-cli download dima806/deepfake_vs_real_image_detection RUN huggingface-cli download umm-maybe/AI-image-detector RUN huggingface-cli download NYUAD-ComNets/NYUAD_AI-generated_images_detector RUN python -c "from transformers import pipeline; pipeline('zero-shot-image-classification', model='openai/clip-vit-base-patch32')" COPY app.py . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]