-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (37 loc) · 1.32 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim-bookworm AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONPATH=/app/src
WORKDIR /app
# Runtime libs:
# - tini/ca-certificates: process + TLS
# - libxcb/libgl/glib/x* libs: required by cv2 pulled by docling_ibm_models (TableFormer)
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
tini \
libglib2.0-0 \
libgl1 \
libsm6 \
libxext6 \
libxrender1 \
libxcb1 \
libxkbcommon0 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd --create-home --home-dir /home/appuser --shell /usr/sbin/nologin appuser
COPY pyproject.toml README.md ./
COPY src ./src
# Editable install keeps prompt markdown files available from source tree.
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
pip install --upgrade pip \
&& pip install -e . \
&& mkdir -p /usr/local/lib/python3.12/site-packages/rapidocr/models \
&& chown -R appuser:appuser /usr/local/lib/python3.12/site-packages/rapidocr/models
USER appuser
EXPOSE 8000
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["python", "-m", "shafi"]