This commit is contained in:
2026-06-22 10:38:41 +08:00
parent 37d43bd177
commit 30ead8fa43
3 changed files with 54 additions and 5 deletions
+16 -4
View File
@@ -1,8 +1,11 @@
# syntax=docker/dockerfile:1
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
HF_HOME=/root/.cache/huggingface \
MODELSCOPE_CACHE=/root/.cache/modelscope
WORKDIR /app
@@ -10,11 +13,20 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Layer 1: Python deps — only rebuilds when pyproject.toml changes.
COPY pyproject.toml README.md ./
COPY src ./src
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade pip \
&& pip install \
"fastapi>=0.115" \
"uvicorn[standard]>=0.30" \
"python-multipart>=0.0.9" \
"pydantic-settings>=2.4" \
"openocr-python==0.1.5"
RUN pip install --upgrade pip \
&& pip install .
# Layer 2: app code — code changes only rerun this lightweight step.
COPY src ./src
RUN pip install --no-deps --no-cache-dir .
EXPOSE 8000