File size: 1,101 Bytes
1aba494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ---- Base Image ----
FROM python:3.10-slim

# ---- System Dependencies ----
RUN apt-get update && apt-get install -y \
    git \
    wget \
    build-essential \
    libopenblas-dev \
    && rm -rf /var/lib/apt/lists/*

# ---- Workspace Setup ----
WORKDIR /app

# ---- Copy Requirements ----
COPY requirements.txt .

# ---- Install Python Dependencies ----
RUN pip install --no-cache-dir -r requirements.txt

# ---- Copy Project Files ----
COPY . .

# ---- Optional: Cache Sentence Transformer Model On Build ----
RUN python - <<EOF
from sentence_transformers import SentenceTransformer, CrossEncoder
print("Downloading embedding model...")
SentenceTransformer("sentence-transformers/paraphrase-multilingual-mpnet-base-v2")
print("Downloading intent model...")
SentenceTransformer("all-MiniLM-L6-v2")
print("Downloading reranker model...")
CrossEncoder("cross-encoder/ms-marco-MiniLM-L-12-v2")
print("All models cached.")
EOF

# ---- Expose Required Port ----
EXPOSE 7860

# ---- Run API ----
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]