# Unkor backend — image Docker pour HuggingFace Spaces (SDK docker, port 7860) FROM python:3.11-slim # Dépendances système : OpenCV (headless) + OpenMP (torch/onnxruntime) RUN apt-get update && apt-get install -y --no-install-recommends \ libglib2.0-0 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # torch + torchvision CPU d'abord (wheels allégés, sans CUDA) — requirements.txt les verra satisfaits RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Cache HuggingFace + logs : emplacements inscriptibles, sortie non bufferisée ENV HF_HOME=/app/.cache/huggingface \ PYTHONUNBUFFERED=1 \ PORT=7860 # Les modèles se téléchargent au démarrage (model_bootstrap.py) dans /app/models ; # /app/data reçoit les benchmarks anonymes (benchmarks.jsonl) RUN mkdir -p /app/models /app/data /app/.cache/huggingface && chmod -R 777 /app/.cache /app/models /app/data EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]