Spaces:
Paused
Paused
| # Utilisation d'une base CUDA optimisée pour les performances | |
| FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 | |
| WORKDIR /app | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV MODEL_PATH=/app/model_cache | |
| # Installation des dépendances système | |
| RUN apt-get update && apt-get install -y \ | |
| python3-pip \ | |
| python3-dev \ | |
| libgomp1 \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Installation de PyTorch et des bibliothèques de calcul | |
| RUN pip3 install --no-cache-dir --upgrade pip | |
| RUN pip3 install --no-cache-dir torch torchvision torchaudio | |
| # Copie et installation des dépendances Python | |
| COPY requirements.txt . | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| RUN pip3 install --upgrade transformers accelerate bitsandbytes sentence-transformers faiss-cpu | |
| # Copie de tout le projet (incluant tools/, static/, etc.) | |
| COPY . . | |
| # Création des dossiers nécessaires avec les bons droits | |
| RUN mkdir -p /app/model_cache /app/static /app/data && chmod -R 777 /app | |
| # Port imposé par Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Lancement de l'API sur le port 7860 | |
| CMD ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |