szoya commited on
Commit
b290e53
·
verified ·
1 Parent(s): 4e64270

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -5
Dockerfile CHANGED
@@ -3,6 +3,8 @@ FROM python:3.9-slim
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 \
@@ -14,12 +16,14 @@ RUN apt-get update && apt-get install -y \
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 \
@@ -28,10 +32,12 @@ RUN pip install --no-cache-dir \
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"]
 
3
  WORKDIR /app
4
 
5
  # System deps (minimal and safe)
6
+ # libgl1 and libglib2.0-0 are required for OpenCV
7
+ # libgomp1 is required for PaddlePaddle math operations
8
  RUN apt-get update && apt-get install -y \
9
  libgl1 \
10
  libglib2.0-0 \
 
16
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
17
 
18
  # 🔒 HARD PIN numpy BEFORE paddle
19
+ # This prevents the binary incompatibility with newer numpy 2.x
20
  RUN pip install --no-cache-dir "numpy==1.26.4"
21
 
22
+ # PaddlePaddle CPU (stable version 2.6.2 matches well with OCR 2.7.x)
23
  RUN pip install --no-cache-dir paddlepaddle==2.6.2
24
 
25
+ # PaddleOCR + API stack
26
+ # 2.7.3 is a "Golden" version: very stable, no weird dependency bugs
27
  RUN pip install --no-cache-dir \
28
  paddleocr==2.7.3 \
29
  opencv-python-headless==4.11.0.86 \
 
32
  python-multipart \
33
  pillow
34
 
35
+ # Copy app code
36
  COPY main.py .
37
 
38
  # 🚫 DO NOT preload models during build
39
+ # NOTE: The first time you send a request, it will take ~20-40s to
40
+ # download the detection and classification models.
41
+ # Subsequent requests will be fast.
42
 
43
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]