File size: 1,668 Bytes
1a6f263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d22531c
1a6f263
 
 
8b73cec
 
1a6f263
d22531c
 
 
 
1a6f263
d22531c
ea0766e
 
 
 
 
d22531c
 
1a6f263
 
 
d22531c
 
 
 
 
 
 
 
 
 
 
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
40
41
42
43
44
45
46
47
48
49
50
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.2.0" \
    "hyper-models[ml]==0.4.0"

# 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"]