# 1. Base Image: Lightweight Python version FROM python:3.10-slim # 2. Hugging Face Security Requirement: Run as non-root user RUN useradd -m -u 1000 user USER user # 3. Set Environment Variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ CREWAI_TELEMETRY_OPT_OUT=true # 4. Set Work Directory inside the user's home folder WORKDIR $HOME/app # 5. Copy and Install Dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 6. Copy Application Code COPY --chown=user . . # 7. Expose Hugging Face Default Port EXPOSE 7860 # 8. Command to Run the Streamlit App CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]