# Use a lightweight Python base image FROM python:3.9-slim # Set the working directory inside the container WORKDIR /code # Copy the requirements file first to leverage Docker layer caching COPY ./requirements.txt /code/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the entire 'app' directory into the container COPY ./app /code/app # Expose the port the app will run on (Hugging Face Spaces default) EXPOSE 7860 # Command to run the application using uvicorn # --host 0.0.0.0 makes the server accessible from outside the container CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]