34 lines
936 B
Docker
34 lines
936 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM python:3.10-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
HF_HOME=/root/.cache/huggingface \
|
|
MODELSCOPE_CACHE=/root/.cache/modelscope
|
|
|
|
WORKDIR /app
|
|
|
|
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 ./
|
|
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"
|
|
|
|
# Layer 2: app code — code changes only rerun this lightweight step.
|
|
COPY src ./src
|
|
RUN pip install --no-deps --no-cache-dir .
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "openocr_markdown.api:app", "--host", "0.0.0.0", "--port", "8000"]
|