Skip to content

Instantly share code, notes, and snippets.

@poptree
Created October 5, 2024 05:48
Show Gist options
  • Save poptree/a8b036563e48bdf680cf55a7e50887e9 to your computer and use it in GitHub Desktop.
Save poptree/a8b036563e48bdf680cf55a7e50887e9 to your computer and use it in GitHub Desktop.
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
# For the convenience for users in China mainland
# COPY apt-sources.list /etc/apt/sources.list
# Install some basic utilities
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y tzdata && apt-get install -y\
curl \
ca-certificates \
sudo \
git \
bzip2 \
libx11-6 \
gcc \
g++ \
tmux \
wget \
git \
zsh \
vim \
libssl-dev \
libusb-1.0-0 \
libgl1-mesa-glx \
openssh-server \
openssh-client \
iputils-ping \
unzip \
cmake \
libosmesa6-dev \
freeglut3-dev \
ffmpeg \
pciutils \
xauth \
llvm \
libsm6 \
libxrender1 \
libfontconfig1 \
freeglut3-dev \
build-essential \
python-is-python3 \
python3.10-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# set the mount
RUN mkdir /run/sshd && mkdir /app && mkdir /app/workspace && mkdir /app/nas_hdd0 && mkdir /app/nas_hdd1 && mkdir /app/nas_hdd2
# Create a non-root user and switch to it.
RUN adduser -u 1000 --disabled-password --gecos '' --shell /bin/bash user \
&& chown -R user:user /app
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# All users can use /home/user as their home directory.
ENV HOME=/home/user \
TMUX_PLUGIN_MANAGER_PATH=~/.tmux/plugins
RUN mkdir $HOME/.cache $HOME/.config $HOME/.ssh \
&& chmod -R 0755 $HOME && \
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDa/eaFG5gLihO1S263MgxfnOlzpG6s1zEI3nAmCjro\n" > $HOME/.ssh/authorized_keys && \
chmod 700 $HOME/.ssh && \
chmod 600 $HOME/.ssh/authorized_keys && \
chmod 777 /app && cd /app
WORKDIR /app
COPY ./docker/.p10k.zsh ./docker/.profile ./docker/.tmux.conf /home/user/
# # set zsh
RUN sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && \
bash ~/.tmux/plugins/tpm/bin/install_plugins
COPY ./docker/.zshrc /home/user/
ENV TORCH_CUDA_ARCH_LIST="7.5 8.0 8.6 8.9 9.0+PTX"
ENV TCNN_CUDA_ARCHITECTURES=90;89;86;80;75
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH}
# RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
WORKDIR /app
RUN pip install --upgrade pip setuptools ninja
RUN pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118
RUN pip install git+https://github.com/KAIR-BAIR/[email protected]
RUN pip install git+https://github.com/NVlabs/tiny-cuda-nn.git#subdirectory=bindings/torch
RUN pip install toml-to-requirements
COPY ./pyproject.toml ./
RUN /home/user/.local/bin/toml-to-req --toml-file pyproject.toml && pip install --no-cache-dir -r requirements.txt
ADD ./ ./inv3d
RUN sudo chown -R user:user ./inv3d
RUN cd ./inv3d && pip install -e .[dev] && cd ..
# Fix the bug in rembg
RUN pip uninstall -y onnxruntime onnxruntime-gpu && pip install --no-cache-dir onnxruntime-gpu
CMD ["/bin/zsh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment