File size: 989 Bytes
e5564f3
 
e33ca39
e5564f3
e33ca39
 
 
 
e5564f3
e33ca39
 
e5564f3
e33ca39
e5564f3
e33ca39
 
 
 
e5564f3
e33ca39
 
e5564f3
3ac77d5
e33ca39
 
 
e5564f3
4642d29
 
e33ca39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# PP-OCRv5 ONNX 轻量部署(RapidOCR + ONNX Runtime)
FROM python:3.10-slim

# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 \
    libglib2.0-0 \
    libgomp1 \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 安装 Python 依赖
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# 复制代码
COPY app.py .

# 预下载 PP-OCRv5 ONNX 模型(避免首次请求慢)
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download('monkt/paddleocr-onnx', 'detection/v5/det.onnx'); hf_hub_download('monkt/paddleocr-onnx', 'languages/english/rec.onnx'); hf_hub_download('monkt/paddleocr-onnx', 'languages/english/dict.txt'); print('PP-OCRv5 ONNX models downloaded')"

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
    CMD curl -f http://localhost:7860/ || exit 1

CMD ["python", "app.py"]