-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (43 loc) · 1.78 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (43 loc) · 1.78 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
59
# ─── Build stage ─────────────────────────────────────────────────────────────
FROM python:3.11-slim AS builder
WORKDIR /app
# System packages needed to compile/install Python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# pyodbc (SQL Server support)
unixodbc-dev \
# psycopg2 binary wheel / general build
gcc \
# unstructured[pdf] – document parsing
libmagic1 \
poppler-utils \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
# Install uv
RUN pip install uv
# Copy dependency files (IMPORTANT: include lock file)
COPY pyproject.toml uv.lock ./
# Install dependencies into a separate directory
RUN uv sync --frozen --no-dev
# ─── Runtime stage ────────────────────────────────────────────────────────────
FROM python:3.11-slim
WORKDIR /app
# Copy only the runtime system libs we need (no build tools)
RUN apt-get update && apt-get install -y --no-install-recommends \
unixodbc \
libmagic1 \
poppler-utils \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
# Bring in the installed Python packages from the builder
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
# Copy the application source (changes frequently — kept after the slow layers)
COPY . /app
# Directory for schema cache and any runtime-written JSON files
RUN mkdir -p chroma_db query_results
EXPOSE 7860
# HOST and PORT can be overridden; defaults match HF Spaces / Docker conventions
ENV HOST=0.0.0.0 \
PORT=7860 \
DATA_DIR=/data
CMD ["python", "main.py"]