-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (43 loc) · 2 KB
/
Dockerfile
File metadata and controls
58 lines (43 loc) · 2 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
48
49
50
51
52
53
54
55
56
57
58
# docproc v2 — Document Intelligence Platform
# Multi-stage build for a lean production image
# Build: docker build -t docproc:2.0 .
# Run: docker run -p 8000:8000 -e OPENAI_API_KEY=sk-xxx docproc:2.0
# -----------------------------------------------------------------------------
# Stage 1: Builder
# -----------------------------------------------------------------------------
FROM python:3.12-slim AS builder
WORKDIR /build
COPY pyproject.toml README.md ./
COPY docproc/ docproc/
# Create venv and install with pip (base + server extras: fastapi, uvicorn, streamlit, etc.)
RUN python -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir ".[server]"
# -----------------------------------------------------------------------------
# Stage 2: Runtime
# -----------------------------------------------------------------------------
FROM python:3.12-slim AS runtime
# Runtime deps: tesseract for OCR, OpenCV libs
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=builder /build/docproc ./docproc
COPY --from=builder /build/README.md .
COPY docproc.example.yaml ./docproc.example.yaml
COPY docker/docproc.default.yaml ./docproc.yaml
COPY docker/docproc.compose.yaml ./docproc.docker.yaml
LABEL org.opencontainers.image.title="docproc"
LABEL org.opencontainers.image.description="Document Intelligence Platform"
LABEL org.opencontainers.image.source="https://github.com/rithulkamesh/docproc"
LABEL org.opencontainers.image.url="https://github.com/rithulkamesh/docproc/pkgs/container/docproc"
RUN addgroup --system app && adduser --system --ingroup app app
USER app
EXPOSE 8000
ENV DOCPROC_CONFIG=/app/docproc.yaml
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/models')" || exit 1
CMD ["docproc-serve"]