FROM python:3.9-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Create a non-root user (Standard HF) RUN useradd -m -u 1000 user WORKDIR /home/user/app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/* # Install python dependencies globally as root COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application and set ownership COPY --chown=user:user . . # Expose port (HF requirement) EXPOSE 7860 # Switch to user USER user # Run application with WebSocket & Custom Domain fixes CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]