# Use official lightweight Python image FROM python:3.11-slim # Set the working directory in the container WORKDIR /app # Copy the requirements file into the container COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the backend source code COPY . . # Expose the Hugging Face Space default port EXPOSE 7860 # Run the FastAPI server using Uvicorn # Cloud Run sets the PORT environment variable automatically, but HF Spaces defaults to 7860 CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]