# Use official Python image FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Create a non-root user for security (required by HF Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory WORKDIR $HOME/app # Copy requirements and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy project files COPY --chown=user . . # Expose port (HF Spaces uses 7860) EXPOSE 7860 # Healthcheck HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health # Run the app CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]