FROM python:3.10-slim RUN apt-get update && apt-get install -y --no-install-recommends \ libglib2.0-0 libsm6 libxext6 libxrender1 libgl1 \ libgomp1 libgfortran5 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 预下载 RapidOCR 模型 RUN python -c "from rapidocr_openvino import RapidOCR; RapidOCR()" COPY app.py . COPY config.yaml . EXPOSE 8082 # 1 worker 避免多进程内存叠加 OOM CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8082", "--workers", "1", "--timeout-keep-alive", "120"]