Update Dockerfile.analyzer
This commit is contained in:
@@ -1,15 +1,26 @@
|
|||||||
FROM mcr.microsoft.com/presidio-analyzer:latest
|
# Partir d'une image Python 3.9 standard et légère
|
||||||
|
FROM python:3.9-slim-bookworm
|
||||||
|
|
||||||
USER root
|
# Définir le répertoire de travail dans le conteneur
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# Installer les dépendances système
|
# Copier tous les fichiers du projet (app.py, requirements.txt, conf/, etc.) dans le WORKDIR
|
||||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
COPY . /app/
|
||||||
|
|
||||||
# Installer le modèle spaCy français
|
# Installer les dépendances Python listées dans requirements.txt
|
||||||
RUN pip install --no-cache-dir \
|
# Cela installera gunicorn, flask, presidio-analyzer, spacy, etc. dans un environnement propre.
|
||||||
https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-3.7.0/fr_core_news_sm-3.7.0-py3-none-any.whl
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
COPY requirements.txt /tmp/
|
# Télécharger et installer le modèle de langue français pour spaCy
|
||||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
# On utilise la commande recommandée par spaCy
|
||||||
|
RUN python -m spacy download fr_core_news_sm
|
||||||
|
|
||||||
COPY conf/default.yaml /usr/bin/presidio-analyzer/presidio_analyzer/conf/default.yaml
|
# 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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user