| # Base image with heavy dependencies (COLMAP, hloc, LightGlue) | |
| # This image is built separately and cached to save 20-25 minutes per build | |
| # Using devel image instead of runtime to include CUDA development tools (nvcc) needed for gsplat | |
| FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel | |
| # Set working directory | |
| WORKDIR /app | |
| # Set timezone and non-interactive mode to avoid prompts during package installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV TZ=UTC | |
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
| # Install system dependencies for COLMAP | |
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| libeigen3-dev \ | |
| libfreeimage-dev \ | |
| libmetis-dev \ | |
| libgoogle-glog-dev \ | |
| libgflags-dev \ | |
| libglew-dev \ | |
| libsuitesparse-dev \ | |
| libboost-all-dev \ | |
| libatlas-base-dev \ | |
| libblas-dev \ | |
| liblapack-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install COLMAP (this takes ~15-20 minutes) | |
| # COLMAP will automatically download and build Ceres Solver as a dependency | |
| RUN git clone --recursive https://github.com/colmap/colmap.git /tmp/colmap && \ | |
| cd /tmp/colmap && \ | |
| git checkout 3.8 && \ | |
| git submodule update --init --recursive && \ | |
| mkdir build && \ | |
| cd build && \ | |
| cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCERES_SOLVER_AUTO=ON && \ | |
| make -j$(nproc) && \ | |
| make install && \ | |
| cd / && \ | |
| rm -rf /tmp/colmap && \ | |
| # Verify COLMAP installation | |
| colmap -h || echo "COLMAP installed" | |
| # Install Python dependencies that don't change often | |
| # Note: Pin PyTorch to 2.1.0 to match CUDA 11.8 in base image (avoid version mismatch with gsplat) | |
| RUN pip install --no-cache-dir \ | |
| "torch==2.1.0" \ | |
| "torchvision==0.16.0" \ | |
| "numpy<2.0" \ | |
| opencv-python \ | |
| pillow \ | |
| tqdm \ | |
| huggingface-hub \ | |
| safetensors \ | |
| einops \ | |
| omegaconf \ | |
| "pycolmap>=0.4.0" \ | |
| "typer[all]>=0.9.0" \ | |
| "matplotlib>=3.5.0" \ | |
| "plotly>=5.0.0" \ | |
| imageio \ | |
| xformers \ | |
| open3d \ | |
| tensorboard | |
| # Install LightGlue (from git) | |
| RUN pip install --no-cache-dir git+https://github.com/cvg/LightGlue.git | |
| # Install hloc (Hierarchical Localization) | |
| RUN git clone https://github.com/cvg/Hierarchical-Localization.git /tmp/hloc && \ | |
| cd /tmp/hloc && \ | |
| pip install --no-cache-dir -e . && \ | |
| cd / && \ | |
| rm -rf /tmp/hloc | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONPATH=/app | |
| # Label for identification | |
| LABEL org.opencontainers.image.title="YLFF Base Image" | |
| LABEL org.opencontainers.image.description="Base image with COLMAP, hloc, and LightGlue pre-installed" | |