FROM python:3.11-slim WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create non-root user for security RUN useradd --create-home --shell /bin/bash app && chown -R app:app /app USER app EXPOSE 5000 CMD ["python", "app.py"]