File size: 776 Bytes
64d289f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.12-slim

# Install uv — 10-100x faster than pip, proper lockfiles
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

# Install system deps for FastEmbed / BGE-M3 CPU inference
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential curl git \
    && rm -rf /var/lib/apt/lists/*

# Copy dependency files first (layer cache optimization)
COPY pyproject.toml uv.lock* ./

# Install all Python dependencies into the project virtual env
RUN uv sync --frozen --no-dev

# Copy application source
COPY . .

# Pre-download BGE-M3 model so cold starts are instant
RUN uv run python -c "from fastembed import TextEmbedding; TextEmbedding('BAAI/bge-m3')" || true

EXPOSE 7860

CMD ["uv", "run", "python", "app.py"]