iconsulting/packages/services/docling-service/Dockerfile

24 lines
762 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM python:3.11-slim
WORKDIR /app
# 系统依赖OCR、图像处理所需的共享库
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./app/
# 构建时预下载模型,避免首次请求延迟
RUN python -c "from docling.document_converter import DocumentConverter; DocumentConverter()"
EXPOSE 3007
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=120s \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:3007/health')" || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3007"]