# Use Python 3.11 (Stable for AI libraries) FROM python:3.11-slim # Set the working directory inside the container WORKDIR /app # Install system dependencies required for OpenCV # (Even 'headless' OpenCV sometimes needs these basic libs) RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (to cache dependencies) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of your application code COPY . . # Expose the port your app runs on EXPOSE 5000 # Command to run the app using Gunicorn (Production server) # "app:app" means "look in app.py for the 'app' variable" CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "120", "app:app"]