szoya commited on
Commit
763116a
·
verified ·
1 Parent(s): 13965ad

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -13
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # System dependencies
6
  RUN apt-get update && apt-get install -y \
7
  libgl1 \
8
  libglib2.0-0 \
@@ -10,27 +10,28 @@ RUN apt-get update && apt-get install -y \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Upgrade pip
14
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
15
 
16
- # PaddlePaddle CPU (correct version)
17
- RUN pip install --no-cache-dir paddlepaddle==2.6.2 --default-timeout=100
18
 
19
- # PaddleOCR + API deps
 
 
 
20
  RUN pip install --no-cache-dir \
21
  paddleocr==2.7.3 \
22
- "numpy<2.0.0" \
23
- opencv-python-headless \
24
- pillow \
25
  fastapi \
26
  uvicorn \
27
- python-multipart
28
-
29
- # Pre-download models
30
- RUN python -c "from paddleocr import PaddleOCR; PaddleOCR(lang='en', use_angle_cls=False)"
31
 
32
  # Copy app
33
  COPY main.py .
34
 
35
- # Start server
 
 
36
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # System deps (minimal and safe)
6
  RUN apt-get update && apt-get install -y \
7
  libgl1 \
8
  libglib2.0-0 \
 
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Upgrade pip stack
14
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
15
 
16
+ # 🔒 HARD PIN numpy BEFORE paddle
17
+ RUN pip install --no-cache-dir "numpy==1.26.4"
18
 
19
+ # PaddlePaddle CPU (stable)
20
+ RUN pip install --no-cache-dir paddlepaddle==2.6.2
21
+
22
+ # PaddleOCR + API stack (NO extra opencv)
23
  RUN pip install --no-cache-dir \
24
  paddleocr==2.7.3 \
25
+ opencv-python-headless==4.11.0.86 \
 
 
26
  fastapi \
27
  uvicorn \
28
+ python-multipart \
29
+ pillow
 
 
30
 
31
  # Copy app
32
  COPY main.py .
33
 
34
+ # 🚫 DO NOT preload models during build
35
+ # PaddleOCR will auto-download at runtime safely
36
+
37
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]