Spaces:
Running
Running
File size: 3,333 Bytes
f9f1bc5 | 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 | FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 \
CUDA_HOME=/usr/local/cuda TORCH_CUDA_ARCH_LIST="8.0" FORCE_CUDA=1 MAX_JOBS=2
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev liblzma-dev libncursesw5-dev libgdbm-dev uuid-dev build-essential git git-lfs wget ca-certificates \
libegl1 libgl1 libglib2.0-0 libxi6 libxkbcommon-x11-0 libxrender1 libsm6 libxext6 \
&& rm -rf /var/lib/apt/lists/*
RUN wget -q https://www.python.org/ftp/python/3.11.16/Python-3.11.16.tgz -O /tmp/python.tgz \
&& echo "6c0bd76ab0ec7d94ed400b1497f01ac6c7751c8822615ee0855a3eb2d893ea76 /tmp/python.tgz" | sha256sum -c - \
&& tar -xzf /tmp/python.tgz -C /tmp \
&& cd /tmp/Python-3.11.16 && ./configure --prefix=/opt/python --with-ensurepip=install \
&& make -j4 && make install \
&& /opt/python/bin/python3.11 -m venv /opt/venv \
&& rm -rf /tmp/Python-3.11.16 /tmp/python.tgz
ENV PATH=/opt/venv/bin:/usr/local/cuda/bin:$PATH
WORKDIR /opt/space
RUN python -m pip install --no-cache-dir pip==24.3.1 setuptools==75.6.0 wheel==0.45.1 ninja==1.11.1.3
COPY docker-requirements.txt .
RUN python -m pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cu121 -r docker-requirements.txt
# Build required CUDA binaries from pinned official sources. No data.pyg.org
# access, no unpinned fallback, and no compilation or pip at startup.
RUN python -m pip wheel --no-cache-dir --no-deps --no-build-isolation --no-binary=torch-cluster \
torch-cluster==1.6.3 -w /opt/wheels \
&& python -m pip install --no-index --no-deps /opt/wheels/torch_cluster-*.whl
RUN git clone --depth 1 --branch v0.7.7 https://github.com/facebookresearch/pytorch3d.git /opt/pytorch3d \
&& python -m pip wheel --no-cache-dir --no-deps --no-build-isolation /opt/pytorch3d -w /opt/wheels \
&& python -m pip install --no-index --no-deps /opt/wheels/pytorch3d-*.whl
RUN python -c "import bpy,torch,torch_cluster,pytorch3d; from pytorch3d import _C; assert torch.__version__ == '2.1.2+cu121'; assert torch.version.cuda == '12.1'; assert torch.ops.torch_cluster.cuda_version() > 0; print('BUILD_BINARY_CHECK_PASS', bpy.app.version_string, torch.__version__, torch_cluster.__version__, pytorch3d.__version__)"
# Keep the exact upstream revision already used by this Space.
RUN git clone https://github.com/jasongzy/Make-It-Animatable.git /opt/space/upstream \
&& git -C upstream checkout d60cc7e01ff8da46448e458dbf450e8967b34e77 \
&& git -C upstream submodule update --init --recursive \
&& wget -q https://github.com/facebookincubator/FBX2glTF/releases/download/v0.9.7/FBX2glTF-linux-x64 -O upstream/util/FBX2glTF \
&& chmod +x upstream/util/FBX2glTF \
&& upstream/util/FBX2glTF --help > /dev/null
COPY docker_patch.py runtime.py preflight.py docker_app.py test_preflight.py ./
RUN python docker_patch.py \
&& python -m unittest -v test_preflight \
&& python -m compileall -q runtime.py preflight.py docker_app.py upstream \
&& python -m pip freeze > /opt/space/build-packages.txt
RUN useradd -m -u 1000 user && chown -R user:user /opt/space
USER user
ENV HOME=/home/user
EXPOSE 7860
CMD ["python", "/opt/space/docker_app.py"]
|