# Use an official Python runtime as a parent image | |
FROM python:3.9-slim | |
# Set the working directory | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
libpq-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install the required Python packages | |
RUN pip install --upgrade pip | |
RUN pip install -r requirements.txt | |
# Expose the port Hugging Face Spaces expects | |
EXPOSE 7860 | |
# Command to run the FastAPI app on Hugging Face Spaces | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |