File size: 1,240 Bytes
0b3d084
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.14-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHON_GIL=0 \
    UV_LINK_MODE=copy

WORKDIR /app

# Install system dependencies for document parsing, OCR, and native builds
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    curl \
    git \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Install uv package manager
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

# Copy dependency specifications first for Docker layer caching
COPY pyproject.toml uv.lock* requirements.txt* packages.txt* README.md* /app/

# Install dependencies into system environment
RUN uv pip install --system -r requirements.txt || uv pip install --system .

# Copy configuration, static assets, scripts and application source code
COPY config.toml /app/config.toml
COPY assets /app/assets
COPY scripts /app/scripts
COPY src /app/src
COPY app.py /app/app.py

# Install docneedle package itself without re-fetching dependencies
RUN uv pip install --system --no-deps .

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=45s --retries=3 \
    CMD curl -f http://localhost:7860/healthz || exit 1

# Start unified Gradio UI + FastAPI backend
CMD ["python", "app.py"]