Commit 4567dd1f authored by AGLANPC\aglan's avatar AGLANPC\aglan

AG

parent 762a009e
...@@ -14,33 +14,25 @@ RUN npm run build ...@@ -14,33 +14,25 @@ RUN npm run build
# ============================================ # ============================================
FROM python:3.11-slim FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \ build-essential \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
# Install Python dependencies
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend/ ./backend/ COPY backend/ ./backend/
# Copy built frontend
COPY --from=frontend-build /build/frontend/dist ./frontend/dist COPY --from=frontend-build /build/frontend/dist ./frontend/dist
# Pre-download the ChromaDB embedding model so first request is fast # Warm up the ChromaDB embedding model so first request is fast
RUN python -c "\ # Using a separate script file to avoid all quoting issues
import chromadb; \ COPY warmup.py /tmp/warmup.py
c = chromadb.Client(); \ RUN python /tmp/warmup.py && rm /tmp/warmup.py
col = c.create_collection('_warmup'); \
col.add(documents=['warmup embedding model'], ids=['0']); \
c.delete_collection('_warmup'); \
print('Embedding model cached.')"
# Create persistent data directory # Create persistent data directories
RUN mkdir -p /data/chromadb /data/uploads RUN mkdir -p /data/chromadb /data/uploads
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
......
import chromadb
client = chromadb.Client()
col = client.create_collection(name="warmup")
col.add(documents=["warmup embedding model"], ids=["id0"])
client.delete_collection(name="warmup")
print("Embedding model cached.")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment