Spaces:
Running
Running
FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 | |
# FROM python:3.10.13-bookworm | |
ENV LC_ALL C.UTF-8 | |
ENV LANG C.UTF-8 | |
ARG UID=1000 | |
ARG UNAME=user | |
ARG DEBIAN_FRONTEND=noninteractive | |
ENV PATH="/home/$UNAME/.local/bin:$PATH" | |
# setup user | |
RUN useradd -m -u $UID $UNAME | |
WORKDIR /home/$UNAME | |
RUN chown -R $UNAME:$UNAME /home/$UNAME | |
# install Python | |
RUN apt-get update -y && \ | |
apt-get install -y software-properties-common build-essential git gcc curl make vim xorg-dev libxcb-shm0 libglu1-mesa-dev clang libc++-dev libc++abi-dev libsdl2-dev ninja-build libxi-dev libtbb-dev libosmesa6-dev libudev-dev autoconf libtool && \ | |
add-apt-repository -y ppa:deadsnakes/ppa && \ | |
apt-get update -y && \ | |
apt-get install -y python3.10 python3.10-dev python3.10-distutils | |
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 | |
USER $UNAME | |
# install python packages | |
COPY --chown=$UNAME requirements.txt /tmp/requirements.txt | |
RUN python3.10 -m pip install --no-cache-dir --upgrade setuptools distlib pip && \ | |
python3.10 -m pip install --no-cache-dir -r /tmp/requirements.txt && \ | |
rm /tmp/requirements.txt | |
RUN python3.10 -m pip install git+https://github.com/facebookresearch/detectron2.git@fc9c33b1f6e5d4c37bbb46dde19af41afc1ddb2a | |
RUN git clone https://github.com/isl-org/Open3D.git && \ | |
cd Open3D/ && \ | |
mkdir build && \ | |
cd build && \ | |
cmake -DENABLE_HEADLESS_RENDERING=ON \ | |
-DBUILD_GUI=OFF \ | |
-DBUILD_WEBRTC=OFF \ | |
-DUSE_SYSTEM_GLEW=OFF \ | |
-DUSE_SYSTEM_GLFW=OFF \ | |
.. && \ | |
make -j$(nproc) && \ | |
make install-pip-package | |
# copy files | |
COPY --chown=$UNAME . /home/$UNAME/opdmulti-demo | |
ENV TORCH_CUDA_ARCH_LIST='8.0' | |
ENV FORCE_CUDA=1 | |
# TODO: just install into /tmp instead of creating a user folder | |
RUN mkdir tmp && \ | |
cd opdmulti-demo/mask2former/modeling/pixel_decoder/ops && \ | |
python3.10 setup.py build install --prefix /home/$UNAME/tmp | |
USER root | |
RUN mv /home/$UNAME/tmp/local/lib/python3.10/dist-packages/MultiScaleDeformableAttention-1.0-py3.10-linux-x86_64.egg /usr/local/lib/python3.10/dist-packages/ && rm -rf /home/$UNAME/tmp | |
USER $UNAME | |
ENV PYTHONPATH="/usr/local/lib/python3.10/dist-packages/MultiScaleDeformableAttention-1.0-py3.10-linux-x86_64.egg" | |
WORKDIR /home/$UNAME/opdmulti-demo | |
CMD ["python3.10", "app.py"] | |