# Use an official Python runtime as a parent image FROM python:3.10-slim # Set the working directory in the container WORKDIR /code # Copy the requirements file into the container at /code COPY ./requirements.txt /code/requirements.txt # Install any needed packages specified in requirements.txt # Use --no-cache-dir to reduce image size # Install libgl1 for OpenCV headless dependencies RUN apt-get update && apt-get install -y libgl1 \ && pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r /code/requirements.txt # Copy the rest of the application code into the container at /code COPY ./app /code/app # Command to run the application when the container launches # Binds to 0.0.0.0 to be accessible from outside the container # The port 7860 is the standard port for Hugging Face Spaces CMD ["uvicorn", "app.backend.main:app", "--host", "0.0.0.0", "--port", "7860"]