iconsulting/packages/services/docling-service/Dockerfile

26 lines
908 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/
COPY scripts/ ./scripts/
# 构建时预下载模型到 /root/.cache/huggingfaceHF 默认路径)
# 运行时通过 Docker volume 持久化该目录,首次启动从镜像初始化 volume
RUN python scripts/preload_models.py || echo "Model preload skipped (will download on first request)"
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"]