-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (53 loc) · 1.95 KB
/
Dockerfile
File metadata and controls
67 lines (53 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# RAGpy - Dockerfile
# Pipeline de traitement de documents pour RAG
FROM python:3.11-slim
# Métadonnées
LABEL maintainer="RAGpy"
LABEL description="Pipeline RAG pour documents académiques (PDF, Zotero, CSV)"
# Variables d'environnement
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# Répertoire de travail
WORKDIR /app
# Installation des dépendances système
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copie des fichiers de dépendances
COPY scripts/requirements.txt /app/requirements.txt
# Installation des dépendances Python
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
playwright install --with-deps chromium
# Téléchargement du modèle spaCy français
RUN python -m spacy download fr_core_news_md
# Copie du code source
COPY . /app/
# Création des répertoires nécessaires
RUN mkdir -p /app/uploads /app/logs /app/data
# Exposition du port
EXPOSE 8000
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Variables Uvicorn avec valeurs par défaut
# NOTE: Using 1 worker for SSE streaming reliability
# Multiple workers cause duplicate logs and SSE connection issues
ENV UVICORN_WORKERS=1
ENV UVICORN_TIMEOUT_KEEP_ALIVE=120
ENV UVICORN_LIMIT_CONCURRENCY=100
# Commande de démarrage (shell form pour expansion variables)
# --proxy-headers: Trust X-Forwarded-Proto, X-Forwarded-For from reverse proxy
# --forwarded-allow-ips: Allow all IPs to set forwarded headers (use specific IP in production)
CMD uvicorn app.main:app \
--host 0.0.0.0 \
--port 8000 \
--workers ${UVICORN_WORKERS} \
--timeout-keep-alive ${UVICORN_TIMEOUT_KEEP_ALIVE} \
--limit-concurrency ${UVICORN_LIMIT_CONCURRENCY} \
--backlog 2048 \
--proxy-headers \
--forwarded-allow-ips "*"