# Use the official Python 3.11 slim image FROM python:3.11-slim # Set the working directory in the container WORKDIR /app # Install system dependencies required for OpenCV RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy the requirements file into the container COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the entire FastAPI app into the container COPY . . # Expose the port that FastAPI will use (default is 8000) EXPOSE 8000 # Set an environment variable for the port ENV PORT=8000 # Command to run the application CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port $PORT"]