# Use a minimal base image with Python 3.9 installed FROM python:3.9-slim # Create a non-root user for Hugging Face compatibility RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory inside the container WORKDIR /home/user/app # Copy all files and set ownership to the 'user' COPY --chown=user . . # Install Python dependencies RUN pip3 install --no-cache-dir -r requirements.txt # CRITICAL: Use port 7860 for Hugging Face Spaces CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]