Files
openocr/Dockerfile
T

34 lines
936 B
Docker
Raw Normal View History

2026-06-22 10:38:41 +08:00
# syntax=docker/dockerfile:1
2026-06-22 08:31:19 +08:00
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
2026-06-22 10:38:41 +08:00
HF_HOME=/root/.cache/huggingface \
MODELSCOPE_CACHE=/root/.cache/modelscope
2026-06-22 08:31:19 +08:00
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
2026-06-22 10:38:41 +08:00
# Layer 1: Python deps — only rebuilds when pyproject.toml changes.
2026-06-22 08:31:19 +08:00
COPY pyproject.toml README.md ./
2026-06-22 10:38:41 +08:00
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"
2026-06-22 08:31:19 +08:00
2026-06-22 10:38:41 +08:00
# Layer 2: app code — code changes only rerun this lightweight step.
COPY src ./src
RUN pip install --no-deps --no-cache-dir .
2026-06-22 08:31:19 +08:00
EXPOSE 8000
CMD ["uvicorn", "openocr_markdown.api:app", "--host", "0.0.0.0", "--port", "8000"]