Spaces:
Paused
Paused
File size: 1,990 Bytes
9d5790d | 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 | # Nori multi-policy inference image (INFERENCE_ENDPOINT_PLAN step 5).
#
# ONE Dockerfile, per-kind requirements via build arg:
# docker build --build-arg MODEL_KIND=molmoact2 -t nori-serve-molmoact2 .
# docker build --build-arg MODEL_KIND=pi05 -t nori-serve-pi05 .
# Run with env MODEL_KIND matching the build arg (the arg only picks which
# requirements file is installed; the env picks the adapter at boot).
#
# Base per kind (BUILD_BASE arg):
# molmoact2 -> pytorch/pytorch:2.5.1-cuda12.1 (the proven Space stack; never
# reinstall torch/torchvision/torchaudio on top — ABI break, space/Dockerfile)
# pi05 -> python:3.12-slim (the pinned lerobot REQUIRES py>=3.12, which no
# pytorch/pytorch image ships; lerobot's own dep spec then installs the torch
# it wants — CUDA-bundled pip wheels, host driver via the endpoint runtime.
# This mirrors lelab's local venv, the combo the pi05 load path was proven on.)
ARG BUILD_BASE=python:3.12-slim
FROM ${BUILD_BASE}
ARG MODEL_KIND=groot
ENV HOME=/home/user \
PYTHONUNBUFFERED=1 \
HF_HOME=/home/user/.cache/huggingface \
HF_HUB_ENABLE_HF_TRANSFER=1 \
MODEL_KIND=${MODEL_KIND}
# ffmpeg for av decode; git for the pinned lerobot install (pi05 kind).
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg libgl1 libglib2.0-0 git && \
rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
WORKDIR /app
COPY --chown=user:user requirements-${MODEL_KIND}.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt hf_transfer
COPY --chown=user:user server.py rtc.py ./
COPY --chown=user:user adapters/ ./adapters/
RUN mkdir -p /home/user/.cache/huggingface && chown -R user:user /home/user /app
USER user
# PORT: Spaces route to 7860; Inference Endpoints take the port from the
# endpoint config — declare 7860 there, or set PORT. health_route=/ready.
EXPOSE 7860
CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860}"]
|