File size: 1,224 Bytes
1d27c7d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # 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"]
|