FROM python:3.9-slim WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create upload directory and set permissions RUN mkdir -p /tmp/uploads && \ chmod 777 /tmp/uploads # Create a non-root user and switch to it RUN useradd -m appuser && \ chown -R appuser:appuser /app USER appuser # Run the application CMD ["python", "app.py"]