FROM python:3.12-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY src/requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY src/ . # Create non-root user for security RUN useradd --create-home appuser && chown -R appuser:appuser /app USER appuser EXPOSE 5000 # Default to production; override with --env-file at runtime CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:create_app()"]