diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..f65d5d2 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,55 @@ +# get the development image from nvidia cuda 12.1 +FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu20.04 + +LABEL name="instantmesh" \ + maintainer="instantmesh" + +# create workspace folder and set it as working directory +RUN mkdir -p /workspace/instantmesh +WORKDIR /workspace + +# Set the timezone +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install -y tzdata && \ + ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + dpkg-reconfigure --frontend noninteractive tzdata + +# update package lists and install git, wget, vim, libegl1-mesa-dev, and libglib2.0-0 +RUN apt-get update && \ + apt-get install -y git wget vim libegl1-mesa-dev libglib2.0-0 unzip + +# install conda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ + chmod +x Miniconda3-latest-Linux-x86_64.sh && \ + ./Miniconda3-latest-Linux-x86_64.sh -b -p /workspace/miniconda3 && \ + rm Miniconda3-latest-Linux-x86_64.sh + +# update PATH environment variable +ENV PATH="/workspace/miniconda3/bin:${PATH}" + +# initialize conda +RUN conda init bash + +# create and activate conda environment +RUN conda create -n instantmesh python=3.10 && echo "source activate instantmesh" > ~/.bashrc +ENV PATH /workspace/miniconda3/envs/instantmesh/bin:$PATH + +RUN conda install Ninja +RUN conda install cuda -c nvidia/label/cuda-12.1.0 -y + +RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121 +RUN pip install xformers==0.0.22.post7 +RUN pip install triton + +# change the working directory to the repository +WORKDIR /workspace/instantmesh + +# other dependencies +ADD ./requirements.txt /workspace/instantmesh/requirements.txt +RUN pip install -r requirements.txt + +COPY . /workspace/instantmesh + +# Run the command when the container starts +CMD ["python", "app.py"] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..3062135 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,13 @@ +# Docker setup + +This docker setup is tested on WSL(Ubuntu). + +make sure you are under directory yourworkspace/instantmesh/ + +run + +`docker build -t instantmesh/deploy:cuda12.1 -f docker/Dockerfile .` + +then run + +`docker run --gpus all -it instantmesh/deploy:cuda12.1` \ No newline at end of file