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 COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt --only-binary :all: # Copy all files into a backend/ subfolder inside the container to match python import paths COPY . /code/backend # Set the Python path to include the root /code directory ENV PYTHONPATH=/code # Hugging Face Spaces routes internal traffic to port 7860 CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]