File size: 900 Bytes
a840639
 
5f6cc53
 
 
 
 
a840639
 
d57c384
a840639
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f6cc53
 
7d769ae
a840639
 
 
df8ceb9
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
FROM python:3.12-slim

# Use a writable Hugging Face cache dir inside /app
ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PORT=7860 \
    HF_HOME=/app/cache/huggingface

WORKDIR /app
RUN chmod -R 777 /app

# faiss / numpy performance dep
RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Optional: prefetch embedding model to reduce first-request latency
RUN python - <<'PY' || true
from sentence_transformers import SentenceTransformer
SentenceTransformer('Qwen/Qwen3-Embedding-0.6B')
PY

COPY . .

# ✅ Create writable data and Hugging Face cache directories
RUN mkdir -p /app/data /app/cache/huggingface && chmod -R 777 /app/data /app/cache/huggingface

EXPOSE 7860

# Start only the API
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]