# ChaosOps AI — Hugging Face Spaces Dockerfile # # Hugging Face Spaces convention: # * Image must run as a non-root user (uid 1000). # * App listens on port 7860 (Spaces routes external traffic to this port). # * /home/user/app is the working directory the Space picks up automatically. # # Build pipeline is split so pip-install layer is cached independently of the # app code — every code edit only re-uploads the small final COPY. FROM python:3.11-slim # System deps: # git — pip needs this to install `chaosops` from the GitHub source. # curl — handy for in-container HF Hub debug; small footprint. RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ && rm -rf /var/lib/apt/lists/* # Non-root user (Spaces requirement). RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Cache pip layer independently of source. COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy the rest of the Space (app.py, README.md, etc.). COPY --chown=user:user . . # Spaces routes traffic to 7860; Gradio binds here. EXPOSE 7860 CMD ["python", "app.py"]