27 lines
1.0 KiB
Docker
27 lines
1.0 KiB
Docker
# Partir d'une image Python 3.9 standard et légère
|
|
FROM python:3.9-slim-bookworm
|
|
|
|
# Définir le répertoire de travail dans le conteneur
|
|
WORKDIR /app
|
|
|
|
# Copier tous les fichiers du projet (app.py, requirements.txt, conf/, etc.) dans le WORKDIR
|
|
COPY . /app/
|
|
|
|
# Installer les dépendances Python listées dans requirements.txt
|
|
# Cela installera gunicorn, flask, presidio-analyzer, spacy, etc. dans un environnement propre.
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Télécharger et installer le modèle de langue français pour spaCy
|
|
# On utilise la commande recommandée par spaCy
|
|
RUN python -m spacy download fr_core_news_sm
|
|
|
|
# Définir la variable d'environnement pour que Presidio trouve notre fichier de configuration
|
|
ENV PRESIDIO_ANALYZER_CONFIG_FILE=/app/conf/default.yaml
|
|
|
|
# Exposer le port que Gunicorn va utiliser
|
|
EXPOSE 5001
|
|
|
|
# Commande finale pour lancer l'application avec Gunicorn
|
|
# Gunicorn va servir notre fichier app.py (et l'instance 'app' à l'intérieur)
|
|
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:5001", "app:app"]
|