File size: 2,968 Bytes
d456104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a7b980
b0fe8ca
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
# ── Base image ─────────────────────────────────────────────────────────────────
# Python 3.11 slim keeps the image small while being recent enough for all deps.
FROM python:3.11-slim

# ── System dependencies ────────────────────────────────────────────────────────
# cmake + build-essential are required to compile llama-cpp-python from source
# if a pre-built wheel is not available for the target platform.
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        cmake \
        git \
        curl \
    && rm -rf /var/lib/apt/lists/*

# ── Working directory ──────────────────────────────────────────────────────────
WORKDIR /app

# ── Python dependencies ────────────────────────────────────────────────────────
# Copy requirements first to leverage Docker layer caching.
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt

# ── Application code ───────────────────────────────────────────────────────────
COPY . .

# Create data directories (they may be empty in the repo)
RUN mkdir -p data/raw data/vector_db data/models

# ── Expose Streamlit port ──────────────────────────────────────────────────────
EXPOSE 8501

# ── Health check ───────────────────────────────────────────────────────────────
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:8501/_stcore/health || exit 1

# ── Entrypoint ─────────────────────────────────────────────────────────────────
# ── Entrypoint ─────────────────────────────────────────────────────────────────
CMD ["sh", "-c", "python scripts/ingest.py 2>/dev/null || true && streamlit run app/main.py --server.port=7860 --server.address=0.0.0.0 --server.headless=true --server.maxUploadSize=200 --server.enableXsrfProtection=false"]