-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from pfxuan/docker-build
Add Docker build
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: OpenSplat (Docker) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [ assigned, opened, synchronize, reopened ] | ||
release: | ||
types: [ published, edited ] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.os }}-cuda-${{ matrix.cuda-version }}-torch-${{ matrix.torch-version }}-${{ matrix.cmake-build-type }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-22.04] # [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04] | ||
arch: [x64] # [x64, x86] | ||
torch-version: [2.1.2, 2.2.1] # [1.12.0, 1.13.0, 2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1] | ||
cuda-version: [11.8.0, 12.1.1] # [12.3.1, 12.1.1, 11.8.0, 11.7.1, 11.6.2, 11.5.2,11.4.4, 11.3.1, 11.2.2, 11.1.1, 11.0.3, cpu] | ||
cmake-build-type: [Release] # [Debug, ClangTidy] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
build-args: | | ||
CUDA_VERSION=${{ matrix.cuda-version }} | ||
TORCH_VERSION=${{ matrix.torch-version }} | ||
CMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} | ||
push: false | ||
tags: opensplat:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} | ||
|
||
ARG TORCH_VERSION=2.2.1 | ||
ARG CUDA_VERSION=12.1.1 | ||
ARG TORCH_CUDA_ARCH_LIST=7.0;7.5 | ||
ARG CMAKE_BUILD_TYPE=Release | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Env variables | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Prepare directories | ||
WORKDIR /code | ||
|
||
# Copy everything | ||
COPY . ./ | ||
|
||
# Install build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
cmake \ | ||
ninja-build \ | ||
libopencv-dev \ | ||
unzip \ | ||
wget \ | ||
sudo && \ | ||
apt-get autoremove -y --purge && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# Install CUDA | ||
RUN bash .github/workflows/cuda/Linux.sh ${CUDA_VERSION} | ||
|
||
# Install libtorch | ||
RUN wget --no-check-certificate -nv https://download.pytorch.org/libtorch/cu"${CUDA_VERSION%%.*}"$(echo $CUDA_VERSION | cut -d'.' -f2)/libtorch-cxx11-abi-shared-with-deps-${TORCH_VERSION}%2Bcu"${CUDA_VERSION%%.*}"$(echo $CUDA_VERSION | cut -d'.' -f2).zip -O libtorch.zip && \ | ||
unzip -q libtorch.zip -d . && \ | ||
rm ./libtorch.zip | ||
|
||
# Configure and build \ | ||
RUN source .github/workflows/cuda/Linux-env.sh cu"${CUDA_VERSION%%.*}"$(echo $CUDA_VERSION | cut -d'.' -f2) && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. \ | ||
-GNinja \ | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ | ||
-DCMAKE_PREFIX_PATH=/code/libtorch \ | ||
-DCMAKE_INSTALL_PREFIX=/code/install \ | ||
-DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}" \ | ||
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_HOME} && \ | ||
ninja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters