Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Non-root user (required by Hugging Face Spaces, good practice elsewhere).
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
| 7 |
+
WORKDIR /home/user/app
|
| 8 |
+
|
| 9 |
+
COPY --chown=user requirements.txt .
|
| 10 |
+
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 11 |
+
|
| 12 |
+
# Pre-download the ONNX embedding model so first query isn't slow.
|
| 13 |
+
RUN python -c "from chromadb.utils.embedding_functions import ONNXMiniLM_L6_V2; ONNXMiniLM_L6_V2()(['warm up'])"
|
| 14 |
+
|
| 15 |
+
COPY --chown=user app/ app/
|
| 16 |
+
# The prebuilt Chroma index must exist (run scripts/build_index.py first).
|
| 17 |
+
COPY --chown=user data/chroma/ data/chroma/
|
| 18 |
+
|
| 19 |
+
# Hugging Face Spaces uses port 7860; Render/Railway inject $PORT.
|
| 20 |
+
ENV PORT=7860
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
|
| 23 |
+
CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT}
|