iconsulting/packages/services/docling-service/Dockerfile

27 lines
955 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/
# 模型缓存目录(运行时通过 Docker volume 持久化到 /models
# 构建时预下载到镜像默认路径;运行时 HF_HOME=/models/huggingface 由 volume 接管
ENV HF_HOME=/root/.cache/huggingface
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"]