Files
HuiBrain/Dockerfile
2026-04-14 17:25:06 +08:00

37 lines
1.1 KiB
Docker
Raw Permalink 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
# ── 系统依赖PaddleOCR 需要的图形库) ──
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
wget \
&& rm -rf /var/lib/apt/lists/*
# ── 设置工作目录 ──
WORKDIR /app
# ── 安装 Python 依赖(先复制 requirements.txt 利用 Docker 缓存) ──
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir paddlepaddle==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
# ── 复制项目代码 ──
COPY . .
# ── 创建数据目录 ──
RUN mkdir -p /app/data/transcripts /app/data/images /app/data/exports
# ── 暴露端口 ──
EXPOSE 8000
# ── 健康检查 ──
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
# ── 启动命令 ──
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]