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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -14
Dockerfile CHANGED
@@ -1,9 +1,8 @@
1
- # Start with a clean Python 3.9 Image
2
  FROM python:3.9-slim
3
 
4
  WORKDIR /app
5
 
6
- # 1. Install System Dependencies
7
  RUN apt-get update && apt-get install -y \
8
  libgl1 \
9
  libglib2.0-0 \
@@ -11,17 +10,15 @@ RUN apt-get update && apt-get install -y \
11
  git \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 2. Upgrade Pip to handle large downloads better
15
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
16
 
17
- # 3. Install PaddlePaddle (CPU)
18
- # We use standard PyPI with a long timeout to prevent connection drops
19
- RUN pip install --no-cache-dir paddlepaddle==2.6.1 --default-timeout=100
20
 
21
- # 4. Install PaddleOCR & API Dependencies
22
- # Pinned versions to ensure 100% compatibility
23
  RUN pip install --no-cache-dir \
24
- "paddleocr==2.7.3" \
25
  "numpy<2.0.0" \
26
  opencv-python-headless \
27
  pillow \
@@ -29,12 +26,11 @@ RUN pip install --no-cache-dir \
29
  uvicorn \
30
  python-multipart
31
 
32
- # 5. Pre-download the AI Models (Cache them inside the image)
33
- # use_angle_cls=False avoids downloading the classifier model
34
  RUN python -c "from paddleocr import PaddleOCR; PaddleOCR(lang='en', use_angle_cls=False)"
35
 
36
- # 6. Copy Application Code
37
  COPY main.py .
38
 
39
- # 7. Start the API
40
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  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
  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 \
 
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"]