FROM python:3.10-slim WORKDIR /app # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV HF_HOME=/app/.cache/huggingface # Install system packages required for compiling libraries (like chromadb) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements.txt from the server/ subdirectory (Crucial difference!) COPY server/requirements.txt /app/server/ # Install Python dependencies RUN pip install --no-cache-dir -r /app/server/requirements.txt # Pre-download and cache the SentenceTransformer model during build time RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-large-en-v1.5')" # Copy the entire project (both client/ and server/) COPY . /app/ # Change working directory to server where main.py resides WORKDIR /app/server # Expose Hugging Face Spaces default port EXPOSE 7860 # Run FastAPI using uvicorn on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]