FROM python:3.11-slim # Create a non-root user (Required for Hugging Face Spaces) RUN useradd -m -u 1000 user # Set working directory WORKDIR /app # Switch to the new user USER user ENV PATH="/home/user/.local/bin:$PATH" # Copy requirements and install COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY --chown=user:user . . # Expose the default port used by Hugging Face Spaces EXPOSE 7860 # Run both the FastAPI backend and Streamlit frontend CMD ["bash", "run.sh"]