Spaces:
Sleeping
Sleeping
File size: 760 Bytes
b9a59c9 | 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 | FROM python:3.10-slim
# Set the working directory
WORKDIR /app
# Install dependencies first (caching layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire project
COPY . .
# Hugging Face Spaces runs as a non-root user (user ID 1000).
# We must give permission to write the database and download the BibTeX files.
RUN chmod -R 777 /app/backend
# Switch to the backend directory where main.py lives
WORKDIR /app/backend
# HF Spaces requires the application to listen on port 7860
EXPOSE 7860
# Give KeyBERT a writable temp folder to download the transformer models
ENV TRANSFORMERS_CACHE="/tmp"
ENV HF_HOME="/tmp"
# Start the FastAPI server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|