Download Dockerfile from Pfe-Spam-Detection/api_spam_detectionv2: direct link, hf CLI and curl.
- Browser
- Download file 645 Bytes
-
https://huggingface.co/spaces/Pfe-Spam-Detection/api_spam_detectionv2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Pfe-Spam-Detection/api_spam_detectionv2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Pfe-Spam-Detection/api_spam_detectionv2/resolve/main/Dockerfile
645 Bytes
| # Utiliser une image Python légère | |
| FROM python:3.9-slim | |
| # Créer un utilisateur pour Hugging Face (sécurité) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:${PATH}" | |
| # Définir le répertoire de travail | |
| WORKDIR /home/user/app | |
| # Copier le fichier des dépendances et les installer | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copier le reste des fichiers (app.py, etc.) | |
| COPY --chown=user:user . . | |
| # Exposer le port utilisé par Hugging Face | |
| EXPOSE 7860 | |
| # Lancer l'application avec Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |