Skip to content

Commit

Permalink
Update Dockerfile to improve build and fix COLMAP to work sometimes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabulani committed Jul 5, 2023
1 parent 6128091 commit 961fc98
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ dependencies/
docs/
.gitignore
Dockerfile
README.md
README.md
requirements/windows/
requirements_windows.bat
.dockerignore
32 changes: 22 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04

# Build arguments. Change these according to Troubleshooting in README.md.
ARG CUDA_ARCHITECTURES=75
ARG NUM_JOBS=4

# Create volumes to persist model checkpoints. This is for documentation: use the -v tag to actually mount the volumes in docker run.
VOLUME /app/model /root/.u2net/

# Prevent stop building ubuntu at time zone selection (from COLMAP Dockerfile).
ENV DEBIAN_FRONTEND=noninteractive

# Update apt-get and install packages
RUN apt-get update && apt-get install -y --no-install-recommends \
# instant-ngp requirements:
Expand All @@ -21,6 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxcursor-dev \
libxrandr-dev \
# COLMAP requirements:
# gcc-10 and g++-10 required for ubuntu22.04
gcc-10 g++-10 \
ninja-build \
libboost-program-options-dev \
Expand All @@ -39,6 +47,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev \
nvidia-container-toolkit \
# For downloading SEEM checkpoint:
wget \
# Required for video to image, and rendering video:
Expand All @@ -49,26 +58,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

# The entire app is installed inside /app
WORKDIR /app
COPY env_file.sh .gitmodules /app/
COPY .gitmodules /app/
ADD .git /app/.git

# Assign environment variables, update and initialize submodules
RUN bash env_file.sh && \
git submodule update --init --recursive
# Update and initialize submodules
RUN git submodule update --init --recursive

# Build instant-ngp. If you get error 137 (insufficient memory), lower the '-j' parameter
WORKDIR /app/dependencies/instant_ngp
RUN cmake . -B build && \
cmake --build build --config RelWithDebInfo -j 4
cmake --build build --config RelWithDebInfo -j ${NUM_JOBS}

# Build COLMAP
ENV CC=/usr/bin/gcc-10 \
WORKDIR /app/dependencies/colmap
ENV QT_XCB_GL_INTEGRATION=xcb_egl \
CC=/usr/bin/gcc-10 \
CXX=/usr/bin/g++-10 \
CUDAHOSTCXX=/usr/bin/g++-10
WORKDIR /app/dependencies/colmap
RUN cmake --version && cmake . -B build -GNinja -D CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} && \
ninja -C build -j 4 && \
ninja -C build install
RUN mkdir build && \
cd build && \
cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} && \
ninja -j ${NUM_JOBS} && \
ninja install && \
cd .. && rm -rf colmap

# Return to app directory
WORKDIR /app
Expand Down
4 changes: 0 additions & 4 deletions env_file.sh

This file was deleted.

0 comments on commit 961fc98

Please sign in to comment.