Skip to content

Commit 3db18ba

Browse files
committed
fix: split pip install layers, move precompute to runtime for Jaguar Space
The HF free-tier Docker builder has tight resource limits: - Split torch/torchvision install into a separate layer - Move dataset precomputation from build to runtime - Increase healthcheck start-period to 600s for first-launch computation
1 parent ee90fec commit 3db18ba

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • spaces/jaguar-reid-megadescriptor-spherical

spaces/jaguar-reid-megadescriptor-spherical/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,20 @@ ARG HYPERVIEW_VERSION=0.3.1
2525

2626
# Install CPU-only PyTorch first (much smaller than default CUDA bundle),
2727
# then the released HyperView package with the ML extras.
28-
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu \
29-
&& pip install "hyperview[ml]==${HYPERVIEW_VERSION}" \
28+
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
29+
RUN pip install "hyperview[ml]==${HYPERVIEW_VERSION}" \
3030
&& python -c "import hyperview; print('hyperview', hyperview.__version__)"
3131

3232
COPY --chown=user demo.py ./demo.py
3333

3434
ENV HYPERVIEW_DATASETS_DIR=/home/user/app/demo_data/datasets \
3535
HYPERVIEW_MEDIA_DIR=/home/user/app/demo_data/media
3636

37-
# Precompute at build time so the Space starts fast.
38-
RUN python -c "from demo import build_dataset; build_dataset()"
39-
4037
EXPOSE 7860
4138

42-
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
39+
HEALTHCHECK --interval=30s --timeout=10s --start-period=600s --retries=3 \
4340
CMD curl -f http://localhost:7860/__hyperview__/health || exit 1
4441

42+
# Dataset is built at first startup (model download + embedding computation).
43+
# After startup the data persists in demo_data/.
4544
CMD ["python", "demo.py"]

0 commit comments

Comments
 (0)