PeterAJansen
Bump UI timeouts, silence transfer warning, shorten short_description
e27e611
Raw
History Blame Contribute Delete
1.73 kB
# Dockerfile for the Hugging Face Spaces deployment of the Scientific
# Contribution Graph Explorer. When you copy this to a Space, rename it
# to `Dockerfile` (no extension).
#
# Build context expects this layout in the Space:
# Dockerfile
# demo.py (the single-file FastAPI app)
# demo_config.json (renamed from demo_huggingface_demo_config.json)
# requirements.txt (renamed from demo_huggingface_requirements.txt)
# README.md (renamed from demo_huggingface_README.md, keep frontmatter)
FROM python:3.11-slim
# Graphviz is needed for the tree / tree-with-edges layouts.
RUN apt-get update \
&& apt-get install -y --no-install-recommends graphviz git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces sets HOME to /home/user; we follow the standard recipe.
RUN useradd -m -u 1000 user
# Pre-create /data so it works whether or not HF Persistent Storage is
# attached. When Persistent Storage is enabled it is mounted at /data
# and survives restarts; otherwise /data is just an empty in-container
# directory that gets wiped each cold boot (and the 7 GB tarball will
# be re-fetched on the next wake).
RUN mkdir -p /data && chown user:user /data
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
HF_XET_HIGH_PERFORMANCE=1
WORKDIR $HOME/app
COPY --chown=user requirements.txt ./
RUN pip install --user --no-cache-dir -r requirements.txt
COPY --chown=user demo.py demo_config.json ./
EXPOSE 7860
# `demo.py` reads `demo_config.json` next to it on startup (data_path,
# bucket_uri, host, port). Override any field via env vars (SCG_DATA_PATH,
# SCG_BUCKET_URI, ...) or CLI flags if needed.
CMD ["python", "demo.py"]