| FROM python:3.11-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 | |
| WORKDIR /home/user/app | |
| RUN pip install --upgrade pip | |
| RUN pip install \ | |
| "hyperview==1.1.1" \ | |
| "hyper-models[ml]==0.3.2" | |
| # The bundle is the unit of delivery: `hyperview serve --from` restores the | |
| # exported workspace, dataset, and layouts from it at startup. | |
| COPY --chown=user bundle /home/user/app/bundle | |
| RUN mkdir -p /home/user/app/data/datasets /home/user/app/data/media | |
| # HyperView mints a session token and rejects unauthenticated runtime | |
| # commands. A public Space has no way to hand visitors that token, so panel | |
| # creation and case switching 401 without this. It marks the server public: | |
| # visitors get the viewer commands and nothing else, so provider registration, | |
| # extension install, tool execution and compute stay closed. | |
| ENV HYPERVIEW_NO_AUTH=1 | |
| ENV HYPERVIEW_DATASETS_DIR=/home/user/app/data/datasets \ | |
| HYPERVIEW_MEDIA_DIR=/home/user/app/data/media | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \ | |
| CMD curl -f http://localhost:7860/api/runtime || exit 1 | |
| # The image carries the bundle and never moves it, so the restored dataset | |
| # points at the bundle's own media instead of copying it a second time. | |
| CMD ["hyperview", "serve", \ | |
| "--from", "/home/user/app/bundle", \ | |
| "--link-media", \ | |
| "--host", "0.0.0.0", \ | |
| "--port", "7860", \ | |
| "--public"] | |