Spaces:
Running
Running
Restore Dockerfile from Make-It-Animatable
Browse files- Dockerfile +45 -0
Dockerfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
| 2 |
+
ENV DEBIAN_FRONTEND=noninteractive PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 \
|
| 3 |
+
CUDA_HOME=/usr/local/cuda TORCH_CUDA_ARCH_LIST="8.0" FORCE_CUDA=1 MAX_JOBS=2
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
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 \
|
| 6 |
+
libegl1 libgl1 libglib2.0-0 libxi6 libxkbcommon-x11-0 libxrender1 libsm6 libxext6 \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
+
RUN wget -q https://www.python.org/ftp/python/3.11.16/Python-3.11.16.tgz -O /tmp/python.tgz \
|
| 9 |
+
&& echo "6c0bd76ab0ec7d94ed400b1497f01ac6c7751c8822615ee0855a3eb2d893ea76 /tmp/python.tgz" | sha256sum -c - \
|
| 10 |
+
&& tar -xzf /tmp/python.tgz -C /tmp \
|
| 11 |
+
&& cd /tmp/Python-3.11.16 && ./configure --prefix=/opt/python --with-ensurepip=install \
|
| 12 |
+
&& make -j4 && make install \
|
| 13 |
+
&& /opt/python/bin/python3.11 -m venv /opt/venv \
|
| 14 |
+
&& rm -rf /tmp/Python-3.11.16 /tmp/python.tgz
|
| 15 |
+
ENV PATH=/opt/venv/bin:/usr/local/cuda/bin:$PATH
|
| 16 |
+
WORKDIR /opt/space
|
| 17 |
+
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
|
| 18 |
+
COPY docker-requirements.txt .
|
| 19 |
+
RUN python -m pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cu121 -r docker-requirements.txt
|
| 20 |
+
# Build required CUDA binaries from pinned official sources. No data.pyg.org
|
| 21 |
+
# access, no unpinned fallback, and no compilation or pip at startup.
|
| 22 |
+
RUN python -m pip wheel --no-cache-dir --no-deps --no-build-isolation --no-binary=torch-cluster \
|
| 23 |
+
torch-cluster==1.6.3 -w /opt/wheels \
|
| 24 |
+
&& python -m pip install --no-index --no-deps /opt/wheels/torch_cluster-*.whl
|
| 25 |
+
RUN git clone --depth 1 --branch v0.7.7 https://github.com/facebookresearch/pytorch3d.git /opt/pytorch3d \
|
| 26 |
+
&& python -m pip wheel --no-cache-dir --no-deps --no-build-isolation /opt/pytorch3d -w /opt/wheels \
|
| 27 |
+
&& python -m pip install --no-index --no-deps /opt/wheels/pytorch3d-*.whl
|
| 28 |
+
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__)"
|
| 29 |
+
# Keep the exact upstream revision already used by this Space.
|
| 30 |
+
RUN git clone https://github.com/jasongzy/Make-It-Animatable.git /opt/space/upstream \
|
| 31 |
+
&& git -C upstream checkout d60cc7e01ff8da46448e458dbf450e8967b34e77 \
|
| 32 |
+
&& git -C upstream submodule update --init --recursive \
|
| 33 |
+
&& wget -q https://github.com/facebookincubator/FBX2glTF/releases/download/v0.9.7/FBX2glTF-linux-x64 -O upstream/util/FBX2glTF \
|
| 34 |
+
&& chmod +x upstream/util/FBX2glTF \
|
| 35 |
+
&& upstream/util/FBX2glTF --help > /dev/null
|
| 36 |
+
COPY docker_patch.py runtime.py preflight.py docker_app.py test_preflight.py ./
|
| 37 |
+
RUN python docker_patch.py \
|
| 38 |
+
&& python -m unittest -v test_preflight \
|
| 39 |
+
&& python -m compileall -q runtime.py preflight.py docker_app.py upstream \
|
| 40 |
+
&& python -m pip freeze > /opt/space/build-packages.txt
|
| 41 |
+
RUN useradd -m -u 1000 user && chown -R user:user /opt/space
|
| 42 |
+
USER user
|
| 43 |
+
ENV HOME=/home/user
|
| 44 |
+
EXPOSE 7860
|
| 45 |
+
CMD ["python", "/opt/space/docker_app.py"]
|