# Use lightweight Python image FROM python:3.10-slim # Prevent Python from writing .pyc files ENV PYTHONDONTWRITEBYTECODE=1 # Ensure logs appear immediately ENV PYTHONUNBUFFERED=1 # Set working directory WORKDIR /app # Install system dependencies (minimal but safe) RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ curl && \ rm -rf /var/lib/apt/lists/* # Copy requirements first (for caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Expose port used by Flask / Gunicorn EXPOSE 7860 # Start server (production-safe) CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]