name: COLMAP (Docker) on: push: branches: - main - release/* pull_request: types: [ assigned, opened, synchronize, reopened ] release: types: [ published, edited ] env: IS_RELEASE: ${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags') }} CCACHE_DIR: build/.ccache CCACHE_MAXSIZE: 100M jobs: build: name: ubuntu-24.04 runs-on: ubuntu-24.04 steps: - name: Free disk space uses: jlumbroso/free-disk-space@v1.3.1 with: tool-cache: false android: true dotnet: true haskell: true large-packages: true docker-images: true swap-storage: true - uses: actions/checkout@v7 - name: Restore compiler cache uses: ./.github/actions/compiler-cache id: cache-ccache with: mode: restore path: ${{ env.CCACHE_DIR }} key-suffix: docker-release_${{ env.IS_RELEASE }} - name: Set up QEMU uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Login to Docker Hub if: ${{ env.IS_RELEASE == 'true' }} uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push run: | dockertag=$(date +%Y%m%d).${{ github.run_number }} if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then cuda_archs="50;60;70;75;90" else cuda_archs="50" fi mkdir -p build/.ccache docker_args=( --file docker/Dockerfile --build-arg CUDA_ARCHITECTURES="$cuda_archs" --build-arg CCACHE_MAXSIZE="${CCACHE_MAXSIZE}" ) docker build . \ "${docker_args[@]}" \ --tag colmap/colmap:$dockertag # Extract updated build caches from the builder stage. docker build . \ "${docker_args[@]}" \ --target cache-export \ --output type=local,dest=build/cache-export rm -rf build/.ccache mv build/cache-export/.ccache build/.ccache rm -rf build/cache-export if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then docker tag colmap/colmap:$dockertag colmap/colmap:latest docker push colmap/colmap:$dockertag docker push colmap/colmap:latest fi - name: Cleanup compiler cache run: | set -x sudo apt-get install -y ccache ccache --cleanup ccache --show-stats --verbose - name: Save compiler cache uses: ./.github/actions/compiler-cache with: mode: save key: ${{ steps.cache-ccache.outputs.key }} path: ${{ env.CCACHE_DIR }} cache-hit: ${{ steps.cache-ccache.outputs.cache-hit }}