sidoutcome commited on
Commit
03eea1e
·
1 Parent(s): 3e4135a

fix: add pip timeout 600s + retries for Chinese CDN, use Python 3.12 default

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -24
Dockerfile CHANGED
@@ -1,10 +1,5 @@
1
  # Hugging Face Spaces Dockerfile for PaddleOCR-VL Document Parser API
2
- # GPU-accelerated document parsing with PaddleOCR-VL-1.5 + PaddlePaddle
3
- # Build: v5.0.0 - PaddleOCR-VL for high-quality OCR on Nvidia L4/T4
4
- #
5
- # NOTE: Run with --shm-size 16g for PaddlePaddle shared memory:
6
- # docker build -t hf-docling .
7
- # docker run --gpus all --shm-size 16g -p 7860:7860 -e API_TOKEN=test hf-docling
8
 
9
  FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
10
 
@@ -12,19 +7,10 @@ USER root
12
 
13
  # Install system dependencies (Python 3.12 is default in Ubuntu 24.04)
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
15
- python3 \
16
- python3-pip \
17
- python3-venv \
18
- python3-dev \
19
- fonts-noto-core \
20
- fonts-noto-cjk \
21
- fontconfig \
22
- libgl1 \
23
- libglib2.0-0 \
24
- poppler-utils \
25
- curl \
26
- && fc-cache -fv \
27
- && rm -rf /var/lib/apt/lists/*
28
 
29
  # Create non-root user for HF Spaces
30
  RUN useradd -m -u 1000 user
@@ -36,7 +22,9 @@ ENV PYTHONUNBUFFERED=1 \
36
  HF_HOME=/home/user/.cache/huggingface \
37
  XDG_CACHE_HOME=/home/user/.cache \
38
  HOME=/home/user \
39
- PATH=/home/user/.local/bin:/usr/local/bin:/usr/bin:$PATH
 
 
40
 
41
  RUN mkdir -p /home/user/.cache/huggingface /home/user/.cache/paddleocr /home/user/app \
42
  && chown -R user:user /home/user
@@ -44,12 +32,14 @@ RUN mkdir -p /home/user/.cache/huggingface /home/user/.cache/paddleocr /home/use
44
  USER user
45
  WORKDIR /home/user/app
46
 
 
 
 
 
 
47
  COPY --chown=user:user requirements.txt .
48
 
49
- # Install PaddlePaddle GPU then Python deps
50
- RUN python3 -m pip install --user --upgrade pip --break-system-packages && \
51
- python3 -m pip install --user --break-system-packages paddlepaddle-gpu==3.2.1 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/ && \
52
- python3 -m pip install --user --break-system-packages -r requirements.txt
53
 
54
  COPY --chown=user:user . .
55
 
 
1
  # Hugging Face Spaces Dockerfile for PaddleOCR-VL Document Parser API
2
+ # v5.0.0 - PaddleOCR-VL-1.5 + Gemini hybrid, L4/T4 GPU
 
 
 
 
 
3
 
4
  FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
5
 
 
7
 
8
  # Install system dependencies (Python 3.12 is default in Ubuntu 24.04)
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ python3 python3-pip python3-venv python3-dev \
11
+ fonts-noto-core fonts-noto-cjk fontconfig \
12
+ libgl1 libglib2.0-0 poppler-utils curl \
13
+ && fc-cache -fv && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
14
 
15
  # Create non-root user for HF Spaces
16
  RUN useradd -m -u 1000 user
 
22
  HF_HOME=/home/user/.cache/huggingface \
23
  XDG_CACHE_HOME=/home/user/.cache \
24
  HOME=/home/user \
25
+ PATH=/home/user/.local/bin:/usr/local/bin:/usr/bin:$PATH \
26
+ PIP_DEFAULT_TIMEOUT=600 \
27
+ PIP_RETRIES=5
28
 
29
  RUN mkdir -p /home/user/.cache/huggingface /home/user/.cache/paddleocr /home/user/app \
30
  && chown -R user:user /home/user
 
32
  USER user
33
  WORKDIR /home/user/app
34
 
35
+ # Install PaddlePaddle GPU from official index (long timeout for Chinese CDN)
36
+ RUN pip install --user --break-system-packages --timeout 600 \
37
+ paddlepaddle-gpu==3.2.1 \
38
+ -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
39
+
40
  COPY --chown=user:user requirements.txt .
41
 
42
+ RUN pip install --user --break-system-packages -r requirements.txt
 
 
 
43
 
44
  COPY --chown=user:user . .
45