FROM python:3.11-slim # Environment safety ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Workdir WORKDIR /app # System deps (minimal) RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (cache friendly) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app code COPY . . # Expose port EXPOSE 5001 # Run with gunicorn (PRODUCTION) # CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:5001", "app:app"] CMD ["python", "app.py"]