FROM python:3.11-slim # Install system utilities (including git and psmisc) RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ git \ psmisc \ && rm -rf /var/lib/apt/lists/* # Set up non-root user (UID 1000 required by Hugging Face Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 WORKDIR $HOME/app # Install Python requirements COPY --chown=user:user requirements.txt $HOME/app/requirements.txt RUN pip install --no-cache-dir --user -r requirements.txt # Copy all application code COPY --chown=user:user . $HOME/app # Ensure start.sh has execution rights RUN chmod +x $HOME/app/start.sh # Expose the default HF Spaces port EXPOSE 7860 # Start the application cleanly through start.sh CMD ["./start.sh"]