# Use a lightweight Python image FROM python:3.9-slim # Set working directory inside the container WORKDIR /app # Copy requirements first (for better caching) COPY requirements.txt . # Install dependencies # 'gunicorn' must be in your requirements.txt or installed here RUN pip install --no-cache-dir -r requirements.txt RUN pip install gunicorn # Copy the rest of the application COPY . . # Expose the internal port (Gunicorn default is 8000, or we choose one) EXPOSE 5000 # Command to run production server # -w 4: 4 worker processes # -b 0.0.0.0:5000: Bind to all interfaces inside container on port 5000 CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:5000", "app:app"]