# Use a lightweight, official Python runtime as a parent image FROM python:3.10-slim # Set the working directory inside the container to /code WORKDIR /code # Copy the requirements file first to leverage Docker's build cache COPY ./requirements.txt /code/requirements.txt # Install all necessary Python packages RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the rest of the application files into the container COPY . . # Expose port 7860 (Hugging Face Spaces expects the container to run on port 7860) EXPOSE 7860 # Command to launch the FastAPI server using Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]