Upload Dockerfile
Browse files- Dockerfile +40 -0
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ---- Base Image ----
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# ---- System Dependencies ----
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
git \
|
| 7 |
+
wget \
|
| 8 |
+
build-essential \
|
| 9 |
+
libopenblas-dev \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
# ---- Workspace Setup ----
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# ---- Copy Requirements ----
|
| 16 |
+
COPY requirements.txt .
|
| 17 |
+
|
| 18 |
+
# ---- Install Python Dependencies ----
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# ---- Copy Project Files ----
|
| 22 |
+
COPY . .
|
| 23 |
+
|
| 24 |
+
# ---- Optional: Cache Sentence Transformer Model On Build ----
|
| 25 |
+
RUN python - <<EOF
|
| 26 |
+
from sentence_transformers import SentenceTransformer, CrossEncoder
|
| 27 |
+
print("Downloading embedding model...")
|
| 28 |
+
SentenceTransformer("sentence-transformers/paraphrase-multilingual-mpnet-base-v2")
|
| 29 |
+
print("Downloading intent model...")
|
| 30 |
+
SentenceTransformer("all-MiniLM-L6-v2")
|
| 31 |
+
print("Downloading reranker model...")
|
| 32 |
+
CrossEncoder("cross-encoder/ms-marco-MiniLM-L-12-v2")
|
| 33 |
+
print("All models cached.")
|
| 34 |
+
EOF
|
| 35 |
+
|
| 36 |
+
# ---- Expose Required Port ----
|
| 37 |
+
EXPOSE 7860
|
| 38 |
+
|
| 39 |
+
# ---- Run API ----
|
| 40 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|