diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml index eeb85f2..e14c657 100644 --- a/.github/workflows/dockerbuild.yml +++ b/.github/workflows/dockerbuild.yml @@ -1,25 +1,11 @@ name: Build and Push Docker Image -on: - push: - branches: - - 'master' - pull_request: - branches: - - main +on: [push, pull_request] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 32768 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - - name: Checkout repo uses: actions/checkout@v2 @@ -29,14 +15,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Login to GHCR - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: dipy - password: ${{secrets.CR_PAT}} - - - name: Build and push docker image - run: sh ./Docker/dockerbuild.sh \ + - name: Build docker image + run: sh ./docker/dockerbuild.sh \ "${{github.sha}}" \ "dipy" + diff --git a/docker/Dockerfile b/docker/Dockerfile index 9ed425d..5fa7a98 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,40 +1,25 @@ -FROM nvcr.io/nvidia/cuda:11.0-devel +ARG NVIDIAVERSION=12.0.1-devel-ubuntu20.04 +FROM nvidia/cuda:${NVIDIAVERSION} SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive -# upgrade -RUN apt update && \ - apt install --assume-yes apt-transport-https \ - ca-certificates gnupg \ - software-properties-common gcc git wget numactl -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ - | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null -RUN apt-add-repository "deb https://apt.kitware.com/ubuntu/ focal main" -RUN apt install -y cmake libncurses5-dev libtinfo6 - -# Anaconda -RUN cd /opt && wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh \ - && bash /tmp/Anaconda3-2020.02-Linux-x86_64.sh -b -p /opt/anaconda \ - && rm -rf /tmp/Anaconda3-2020.02-Linux-x86_64.sh \ - && eval "$(/opt/anaconda/bin/conda shell.bash hook)" +RUN apt-get update && apt-get install --assume-yes apt-transport-https \ + ca-certificates gnupg software-properties-common gcc git wget numactl cmake + +RUN wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh +RUN bash /tmp/Anaconda3-2022.10-Linux-x86_64.sh -b -p /opt/anaconda +RUN rm -rf /tmp/Anaconda3-2022.10-Linux-x86_64.sh +RUN cd /opt && eval "$(/opt/anaconda/bin/conda shell.bash hook)" ENV PATH /opt/anaconda/bin:${PATH} ENV LD_LIBRARY_PATH /opt/anaconda/lib:${LD_LIBRARY_PATH} # python prereqs RUN pip install numpy scipy cython nibabel dipy tqdm -# copy stuff -COPY CMakeLists.txt /opt/GPUStreamlines/CMakeLists.txt -COPY run_dipy_gpu.py /opt/GPUStreamlines/run_dipy_gpu.py -COPY run_dipy_cpu.py /opt/GPUStreamlines/run_dipy_cpu.py -COPY run_dipy_gpu_hardi.py /opt/GPUStreamlines/run_dipy_gpu_hardi.py -COPY run_dipy_cpu_hardi.py /opt/GPUStreamlines/run_dipy_cpu_hardi.py -COPY merge_trk.sh /opt/exec/merge_trk.sh -COPY cuslines /opt/GPUStreamlines/cuslines -COPY external /opt/GPUStreamlines/external -RUN mkdir -p /opt/exec/output +RUN git clone --recurse-submodules https://github.com/dipy/GPUStreamlines.git +RUN cd GPUStreamlines && pip install . # compile RUN cd /opt/GPUStreamlines && mkdir build && cd build \ diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index c303a87..a588ee4 100644 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -1,7 +1,7 @@ COMMIT=${1} COMMIT="$(echo "${COMMIT}" | tr -d '[:space:]')" export COMMIT -NO_TAG="ghcr.io/${2}/GPUStreamlines" +NO_TAG="ghcr.io/${2}/gpustreamlines" TAG="${NO_TAG}:${COMMIT}" TAG2="${NO_TAG}:latest" TAG="$(echo "${TAG}" | tr -d '[:space:]')" @@ -10,4 +10,3 @@ NO_TAG="$(echo "${NO_TAG}" | tr -d '[:space:]')" echo $TAG docker build --no-cache -t $TAG -t $TAG2 --build-arg COMMIT ./docker -docker push --all-tags $NO_TAG