SamiKLN commited on
Commit
3b78f24
·
verified ·
1 Parent(s): c745dd7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -6
Dockerfile CHANGED
@@ -2,25 +2,32 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  poppler-utils \
8
  libmagic1 \
9
  ffmpeg \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Copy requirements FIRST for better caching
13
- COPY requirements.txt . # Ligne modifiée
 
 
 
 
 
 
 
 
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Copy application
17
  COPY . .
18
 
19
- # Create upload directory
20
  RUN mkdir -p /app/uploads && \
21
  chmod -R a+rwx /app/uploads
22
 
23
- # Environment variables
24
  ENV PYTHONPATH=/app
25
  ENV UPLOAD_FOLDER=/app/uploads
26
  ENV HF_TOKEN=${HF_TOKEN}
 
2
 
3
  WORKDIR /app
4
 
5
+ # 1. Installer les dépendances système
6
  RUN apt-get update && apt-get install -y \
7
  poppler-utils \
8
  libmagic1 \
9
  ffmpeg \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # 2. Créer requirements.txt directement si manquant
13
+ RUN if [ ! -f requirements.txt ]; then \
14
+ echo "fastapi==0.95.2" > requirements.txt && \
15
+ echo "uvicorn==0.22.0" >> requirements.txt && \
16
+ echo "python-multipart==0.0.6" >> requirements.txt && \
17
+ echo "huggingface-hub==0.16.4" >> requirements.txt && \
18
+ echo "PyMuPDF==1.22.5" >> requirements.txt; \
19
+ fi
20
+
21
+ # 3. Installer les dépendances Python
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # 4. Copier l'application
25
  COPY . .
26
 
27
+ # 5. Configuration finale
28
  RUN mkdir -p /app/uploads && \
29
  chmod -R a+rwx /app/uploads
30
 
 
31
  ENV PYTHONPATH=/app
32
  ENV UPLOAD_FOLDER=/app/uploads
33
  ENV HF_TOKEN=${HF_TOKEN}