diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..2d1477bd --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +./docs diff --git a/.github/workflows/build_publish_container.yml b/.github/workflows/build_publish_container.yml new file mode 100644 index 00000000..9bfce4b3 --- /dev/null +++ b/.github/workflows/build_publish_container.yml @@ -0,0 +1,54 @@ +name: Build and Publish Container + +on: + # run it on push to the default repository branch + push: + branches: [master] + # run it during pull request + pull_request: + +jobs: + # define job to build and publish docker image + build-and-push-docker-image: + name: Build Docker image and push to repositories + # run only when code is compiling and tests are passing + runs-on: ubuntu-latest + + # steps to perform in job + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # setup Docker buld action + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to Github Packages + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image and push to Docker Hub and GitHub Container Registry + uses: docker/build-push-action@v2 + with: + # relative path to the place where source code with Dockerfile is located + context: ./ + # Note: tags has to be all lower-case + tags: | + micalab/micapipe:latest + ghcr.io/mica-mni/micapipe:latest + # build on feature branches, push only on master branch + push: ${{ github.ref == 'refs/heads/master' }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} + diff --git a/Dockerfile b/Dockerfile index 431a07c9..abc8d45e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,12 +72,12 @@ RUN apt-get update -qq \ && make install \ && rm -rf /tmp/dcm2niix -ENV FSLDIR="/opt/fsl-6.0.3" \ - PATH="/opt/fsl-6.0.3/bin:$PATH" \ +ENV FSLDIR="/opt/fsl-6.0.2" \ + PATH="/opt/fsl-6.0.2/bin:$PATH" \ FSLOUTPUTTYPE="NIFTI_GZ" \ FSLMULTIFILEQUIT="TRUE" \ - FSLTCLSH="/opt/fsl-6.0.3/bin/fsltclsh" \ - FSLWISH="/opt/fsl-6.0.3/bin/fslwish" \ + FSLTCLSH="/opt/fsl-6.0.2/bin/fsltclsh" \ + FSLWISH="/opt/fsl-6.0.2/bin/fslwish" \ FSLLOCKDIR="" \ FSLMACHINELIST="" \ FSLREMOTECALL="" \ @@ -105,15 +105,15 @@ RUN apt-get update -qq \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && echo "Downloading FSL ..." \ - && mkdir -p /opt/fsl-6.0.3 \ - && curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.3-centos6_64.tar.gz \ - | tar -xz -C /opt/fsl-6.0.3 --strip-components 1 \ + && mkdir -p /opt/fsl-6.0.2 \ + && curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.2-centos6_64.tar.gz \ + | tar -xz -C /opt/fsl-6.0.2 --strip-components 1 \ && sed -i '$iecho Some packages in this Docker container are non-free' $ND_ENTRYPOINT \ && sed -i '$iecho If you are considering commercial use of this container, please consult the relevant license:' $ND_ENTRYPOINT \ && sed -i '$iecho https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence' $ND_ENTRYPOINT \ && sed -i '$isource $FSLDIR/etc/fslconf/fsl.sh' $ND_ENTRYPOINT -RUN bash -c 'bash /opt/fsl-6.0.3/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.3' +RUN bash -c 'bash /opt/fsl-6.0.2/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.2' ENV FREESURFER_HOME="/opt/freesurfer-6.0.0" \ PATH="/opt/freesurfer-6.0.0/bin:$PATH" @@ -271,12 +271,12 @@ RUN set -uex; LD_LIBRARY_PATH=/lib64/:$PATH; apt install - RUN bash -c 'wget https://www.dropbox.com/s/47lu1nojrderls1/install_R_env.sh?dl=0 -O /opt/install_R_env.sh && \ bash /opt/install_R_env.sh && cd /opt/afni-latest && rPkgsInstall -pkgs ALL' -COPY [".", "/opt/micapipe"] -RUN bash -c 'cd /opt/micapipe && mv fix_settings.sh /opt/fix1.068/settings.sh && mv fsl_conf/* /opt/fsl-6.0.3/etc/flirtsch/' +COPY . /opt/micapipe/ +RUN bash -c 'cd /opt/micapipe && mv fix_settings.sh /opt/fix1.068/settings.sh && mv fsl_conf/* /opt/fsl-6.0.2/etc/flirtsch/' -RUN bash -c 'mv /opt/micapipe/surfaces/fsaverage5 /opt/freesurfer-6.0.0/subjects' +RUN bash -c 'cp -r /opt/micapipe/surfaces/fsaverage5 /opt/freesurfer-6.0.0/subjects' WORKDIR /home/mica @@ -286,4 +286,4 @@ RUN sed -i '$isource /opt/freesurfer-6.0.0/SetUpFreeSurfer.sh' $ND_ENTRYPOINT RUN sed -i '$iexport FIXPATH=/opt/fix && export PATH="${FIXPATH}:${PATH}"' $ND_ENTRYPOINT -ENTRYPOINT ["/neurodocker/startup.sh", "/opt/micapipe/mica-pipe"] \ No newline at end of file +ENTRYPOINT ["/neurodocker/startup.sh", "/opt/micapipe/micapipe"] diff --git a/generate_micapipe_images.sh b/generate_micapipe_images.sh index f4425a95..ebd3615a 100644 --- a/generate_micapipe_images.sh +++ b/generate_micapipe_images.sh @@ -2,19 +2,19 @@ set -e -# Generate Dockerfile. +# Generate Dockerfile using neurodocker 0.7.0 generate() { docker run --rm neurodocker:local generate "$1" \ --base=ubuntu:bionic-20201119 \ --pkg-manager=apt \ --install "gcc g++ lsb-core bsdtar jq libopenblas-dev tree openjdk-8-jdk libstdc++6" \ --dcm2niix version=v1.0.20190902 method=source\ - --fsl version=6.0.3 \ + --fsl version=6.0.2 \ --run-bash 'bash /opt/fsl-6.0.3/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.3' \ --freesurfer version=6.0.0 \ --matlabmcr version=2017b\ --afni version=latest\ - --ants version=2.3.4 \ + --ants version=2.3.1 \ # change manually the Dockefile to 2.3.4 --run-bash "apt-get update && apt-get install -y gnupg2 && wget -O- http://neuro.debian.net/lists/xenial.de-fzj.full | tee /etc/apt/sources.list.d/neurodebian.sources.list && apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9 && apt-get update && apt-get install -y connectome-workbench=1.3.2-2~nd16.04+1" \ --run-bash "cd /opt/ && wget http://www.fmrib.ox.ac.uk/~steve/ftp/fix1.068.tar.gz && tar xvfz fix1.068.tar.gz && rm fix1.068.tar.gz" \ --user=mica \