Spaces:
Sleeping
Sleeping
File size: 1,068 Bytes
2e9afea fba31c1 2e9afea fba31c1 2e9afea fba31c1 2e9afea fba31c1 2e9afea fba31c1 2e9afea fba31c1 | 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 31 32 33 34 | 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"] |