Spaces:
Running
Running
XQ commited on
Commit ·
be6dcb4
1
Parent(s): e1f18ed
Use full Spaces setup in Dockerfile: nginx, supervisord, build-time ingestion
Browse files- Dockerfile +29 -4
Dockerfile
CHANGED
|
@@ -2,17 +2,42 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
COPY requirements.txt .
|
| 8 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 9 |
|
|
|
|
| 10 |
COPY . .
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
RUN chmod +x scripts/docker-entrypoint.sh
|
| 15 |
|
| 16 |
-
EXPOSE
|
| 17 |
|
| 18 |
-
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# ---------- System packages: nginx + supervisor + curl -----------------------
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get install -y --no-install-recommends nginx supervisor curl && \
|
| 8 |
+
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# ---------- Python dependencies -----------------------------------------------
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
+
# ---------- Application code --------------------------------------------------
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
+
# ---------- Pre-download sentence-transformers models -------------------------
|
| 18 |
+
RUN python -c "\
|
| 19 |
+
from sentence_transformers import SentenceTransformer, CrossEncoder; \
|
| 20 |
+
SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2'); \
|
| 21 |
+
CrossEncoder('cross-encoder/mmarco-mMiniLMv2-L12-H384-v1')"
|
| 22 |
|
| 23 |
+
# ---------- Build-time ingestion: import docs into Qdrant local ---------------
|
| 24 |
+
ENV QDRANT_PATH=/app/qdrant_data \
|
| 25 |
+
QDRANT_URL="" \
|
| 26 |
+
EMBEDDING_PROVIDER=local \
|
| 27 |
+
LLM_PROVIDER=google_genai \
|
| 28 |
+
API_BASE_URL=http://localhost:8000
|
| 29 |
+
RUN python -m scripts.ingest
|
| 30 |
+
|
| 31 |
+
# ---------- Nginx config: port 7860 reverse proxy ----------------------------
|
| 32 |
+
RUN rm /etc/nginx/sites-enabled/default
|
| 33 |
+
COPY nginx.spaces.conf /etc/nginx/conf.d/default.conf
|
| 34 |
+
|
| 35 |
+
# ---------- Supervisord config ------------------------------------------------
|
| 36 |
+
COPY supervisord.spaces.conf /etc/supervisor/conf.d/supervisord.conf
|
| 37 |
+
|
| 38 |
+
# ---------- Entrypoint --------------------------------------------------------
|
| 39 |
RUN chmod +x scripts/docker-entrypoint.sh
|
| 40 |
|
| 41 |
+
EXPOSE 7860
|
| 42 |
|
| 43 |
+
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|