FROM python:3.10-slim # System dependencies RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Set up user and working directory RUN useradd -m -u 1000 appuser USER appuser ENV HOME=/home/appuser \ PATH=/home/appuser/.local/bin:$PATH WORKDIR $HOME/app # Install python dependencies COPY --chown=appuser requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy source code and install the package COPY --chown=appuser . . RUN pip install --user -e . EXPOSE 7860 # Start Gradio app CMD ["python", "app.py"]