8000 Dockerfile improvements by pablospe · Pull Request #2356 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Dockerfile improvements #2356

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

Merged
merged 2 commits into from
Jan 18, 2024
Merged
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
26 changes: 13 additions & 13 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG NVIDIA_CUDA_VERSION=12.3.1
FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as builder

ARG COLMAP_GIT_COMMIT=main
ARG CUDA_ARCHITECTURES=50
ARG CUDA_ARCHITECTURES=native
ENV QT_XCB_GL_INTEGRATION=xcb_egl

# Prevent stop building ubuntu at time zone selection.
Expand Down Expand Up @@ -38,27 +38,22 @@ RUN apt-get update && \
libceres-dev

# Build and install COLMAP.
RUN git clone https://github.com/colmap/colmap.git colmap_${COLMAP_GIT_COMMIT}
RUN cd colmap_${COLMAP_GIT_COMMIT} && \
RUN git clone https://github.com/colmap/colmap.git
RUN cd colmap && \
git fetch https://github.com/colmap/colmap.git ${COLMAP_GIT_COMMIT} && \
git checkout FETCH_HEAD && \
mkdir build && \
cd build && \
cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} \
-DCMAKE_INSTALL_PREFIX=/colmap && \
ninja install && \
cd .. && rm -rf colmap_${COLMAP_GIT_COMMIT}

# Add the installation directory to the PATH.
ENV PATH="/colmap/bin:$PATH"

-DCMAKE_INSTALL_PREFIX=/colmap_installed && \
ninja install

#
# Docker runtime stage.
#
FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} as runtime

# Minimal dependencies to run colmap binary compiled in the builder stage.
# Minimal dependencies to run COLMAP binary compiled in the builder stage.
# Note: this reduces the size of the final image considerably, since all the
# build dependencies are not needed.
RUN apt-get update && \
Expand All @@ -76,5 +71,10 @@ RUN apt-get update && \
libqt5gui5 \
libqt5widgets5

COPY --from=builder /colmap/bin/colmap /colmap/bin/colmap
ENV PATH="/colmap/bin:$PATH"
# Copy all files from /colmap_installed/ in the builder stage to /usr/local/ in
# the runtime stage. This simulates installing COLMAP in the default location
# (/usr/local/), which simplifies environment variables. It also allows the user
# of this Docker image to use it as a base image for compiling against COLMAP as
# a library. For instance, CMake will be able to find COLMAP easily with the
# command: find_package(COLMAP REQUIRED).
COPY --from=builder /colmap_installed/ /usr/local/
0