FROM python:3.10-slim # Set up a non-root user as recommended by Hugging Face RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Copy requirement files and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy everything else with correct ownership COPY --chown=user . . # Explicitly expose port 7860 EXPOSE 7860 CMD ["python", "app.py"]