FROM python:3.9-slim # Create a non-root user RUN useradd -m -u 1000 user USER user ENV HOME=/home/user WORKDIR $HOME/app # Copy and install dependencies COPY --chown=user requirements.txt requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY --chown=user . . # Expose the application port EXPOSE 7860 # Run the application CMD ["python", "app.py"]