File size: 1,073 Bytes
8c3e275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.12-slim-bookworm

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    gcc \
    g++ \
    tesseract-ocr \
    tesseract-ocr-eng \
    ffmpeg \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN pip install --no-cache-dir --upgrade pip setuptools wheel

COPY pyproject.toml README.md ./
COPY src/ ./src/
COPY grammars/ ./grammars/
COPY web/ ./web/
COPY scripts/ ./scripts/

RUN mkdir -p models && \
    pip install --no-cache-dir -e . && \
    pip install --no-cache-dir -e .[web]

EXPOSE 7860

VOLUME ["/app/models", "/app/web/static/uploads", "/app/pageparse.db"]

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/telemetry')" || exit 1

ENTRYPOINT ["python", "-m", "pageparse.cli", "serve", "--host", "0.0.0.0", "--port", "7860"]