Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker build scripts #303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ the examples (requires to install some exta dependences via `pip install -r exam
- [Fit a 2D image with 3D Gaussians.](https://docs.gsplat.studio/main/examples/image.html)
- [Render a large scene in real-time.](https://docs.gsplat.studio/main/examples/large_scale.html)

## Docker

We provide a script for building docker image

```bash
bash docker/build_image.sh
```

Then you can run task in docker container

## Development and Contribution

Expand Down
23 changes: 23 additions & 0 deletions docker/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
export BASE_IMAGE=ubuntu:20.04
export GSPLAT_VERSION=`cat gsplat/version.py | cut -d '"' -f 2`
export CUDA_VERSION=11-7

echo "build gsplat base image"
docker build --build-arg BASE_IMAGE="${BASE_IMAGE}" \
--build-arg CUDA_VERSION="${CUDA_VERSION}" \
-t nerfstudio-gsplat-base:"${GSPLAT_VERSION}" \
-f ./docker/gsplat_base.dockerfile .

echo "build gsplat wheel"
# create a container to build wheel for only container can use CUDA
docker run -t --rm --name nerfstudio-gsplat-wheel \
--gpus 1 -v $PWD:/gsplat \
nerfstudio-gsplat-base:"${GSPLAT_VERSION}" \
bash -c "cd /gsplat && python3 setup.py sdist bdist_wheel"

echo "build gsplat worker image"
docker build --build-arg BASE_IMAGE=nerfstudio-gsplat-base:"${GSPLAT_VERSION}" \
--build-arg GSPLAT_VERSION="${GSPLAT_VERSION}" \
-t nerfstudio-gsplat-worker:"${GSPLAT_VERSION}" \
-f ./docker/gsplat_worker.dockerfile .
16 changes: 16 additions & 0 deletions docker/gsplat_base.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG BASE_IMAGE ubuntu:20.04
FROM ${BASE_IMAGE}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y apt-utils wget software-properties-common build-essential curl
RUN add-apt-repository ppa:deadsnakes/ppa && apt update && \
apt install -y python3.10 libpython3.10-dev python3.10-venv python-is-python3
RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.10 get-pip.py
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 100
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
dpkg -i cuda-keyring_1.0-1_all.deb && rm cuda-keyring_1.0-1_all.deb
ARG CUDA_VERSION=11-7
RUN apt update && apt install -y cuda-toolkit-${CUDA_VERSION}
ENV PATH ${PATH}:/usr/local/cuda/bin
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
ENV CUDA_HOME /usr/local/cuda
RUN pip3 install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1
8 changes: 8 additions & 0 deletions docker/gsplat_worker.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN mkdir -p /workspace
ARG GSPLAT_VERSION 1.1.1
COPY dist/gsplat-${GSPLAT_VERSION}-cp310-cp310-linux_x86_64.whl /workspace
RUN pip3 install /workspace/gsplat-${GSPLAT_VERSION}-cp310-cp310-linux_x86_64.whl && \
rm /workspace/gsplat-${GSPLAT_VERSION}-cp310-cp310-linux_x86_64.whl
WORKDIR /workspace