Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Variables d'environnement | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| PYTHONPATH=/app | |
| # Variables pour les modèles ML - utilisation de /tmp (toujours writable) | |
| ENV HF_HOME=/tmp/cache \ | |
| TRANSFORMERS_CACHE=/tmp/cache \ | |
| HF_HUB_CACHE=/tmp/cache/hub \ | |
| SENTENCE_TRANSFORMERS_HOME=/tmp/cache/sentence_transformers | |
| # Répertoire de travail | |
| WORKDIR /app | |
| # Installer les dépendances système | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Installer uv | |
| RUN pip install uv | |
| # Copier et installer les dépendances Python | |
| COPY requirements.txt . | |
| RUN uv pip install --system --no-cache -r requirements.txt | |
| # Copier le code source | |
| COPY . . | |
| # Créer les répertoires de cache dans /tmp (toujours writable) | |
| RUN mkdir -p /tmp/cache/hub \ | |
| /tmp/cache/sentence_transformers \ | |
| /tmp/vector_store && \ | |
| chmod -R 777 /tmp | |
| # Exposer le port HF Spaces | |
| EXPOSE 7860 | |
| # Commande de démarrage | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |