File size: 1,054 Bytes
974f31e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d110c29
 
974f31e
 
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
FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    git \
    libssl-dev \
    pkg-config \
    && 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 \
    HYPERVIEW_DATASETS_DIR=/home/user/app/demo_data/datasets \
    HYPERVIEW_MEDIA_DIR=/home/user/app/demo_data/media

WORKDIR $HOME/app

RUN pip install --upgrade pip

ARG HYPERVIEW_VERSION=0.3.1
RUN pip install "hyperview[ml]==${HYPERVIEW_VERSION}" "datasets>=3.0.0" "numpy>=1.26.0" "pillow>=10.0.0" \
    && python -c "import hyperview; print('hyperview', hyperview.__version__)"

COPY --chown=user demo.py ./demo.py
COPY --chown=user assets ./assets

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=10 \
    CMD sh -c "curl -f http://127.0.0.1:${PORT:-7860}/__hyperview__/health || exit 1"

CMD ["python", "demo.py"]