File size: 1,523 Bytes
9b5a46a
 
b4470c3
9b5a46a
 
 
b4470c3
9b5a46a
 
 
 
b4470c3
9b5a46a
b4470c3
9b5a46a
 
 
 
f0288ef
9b5a46a
 
 
 
 
b4470c3
 
9b5a46a
 
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
# ── Base image ────────────────────────────────────────────────────────────────
FROM python:3.11-slim

# HuggingFace Spaces runs as a non-root user (UID 1000)
RUN useradd -m -u 1000 user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR $HOME/app

# ── Install dependencies ───────────────────────────────────────────────────────
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# ── Copy application files ────────────────────────────────────────────────────
# Make sure faiss_index/, prompt_engineering.py, and main.py are all present
COPY --chown=user . .

# ── Expose port 7860 (required by HuggingFace Spaces) ────────────────────────
EXPOSE 7860

# ── Launch ────────────────────────────────────────────────────────────────────
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]