Spaces:
Sleeping
Sleeping
File size: 837 Bytes
322102c | 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 | # HF Spaces requires a non-root user with UID 1000
FROM python:3.11-slim
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /app
# Install dependencies before copying source for better layer caching
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Bake the embedding model into the image so there is no download on cold start
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
# Copy application source (data.json is excluded via .dockerignore)
COPY --chown=user . .
# Seed data.json with the 16 sample documents
RUN python demo.py
# HF Spaces expects the app on port 7860
EXPOSE 7860
ENV PORT=7860
CMD ["python", "app.py"]
|