FROM python:3.11-slim WORKDIR /code # Install system libraries needed for database drivers RUN apt-get update && apt-get install -y \ build-essential \ libpq-dev \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install dependencies in binary mode to avoid compiler blocks COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt --only-binary :all: # Copy the rest of the application files COPY . /code # Hugging Face Spaces routes internal traffic to port 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]