File size: 1,117 Bytes
6a64ba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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"]