FROM python:3.10-slim # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # Set up a non-root user (important for HF Spaces) RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:${PATH}" WORKDIR /app # 1. Copy requirements first to speed up future builds COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # 2. Copy the rest of the files COPY --chown=user . . # 3. Port setup ENV PORT=7860 EXPOSE 7860 # Add the --server.enableXsrfProtection=false flag CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]