diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4d97f37fb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,94 @@ +FROM rocker/tidyverse:4.2.3 AS builder + +COPY . /opt/src/ANTsR + +WORKDIR /opt/src + +RUN git clone --depth 1 https://github.com/stnava/ITKR.git && \ + git clone --depth 1 https://github.com/ANTsX/ANTsRCore.git + +# Get CMake +RUN wget https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-x86_64.sh && \ + chmod u+x cmake-3.25.3-linux-x86_64.sh && \ + ./cmake-3.25.3-linux-x86_64.sh --skip-license --prefix=/usr/local && \ + rm ./cmake-3.25.3-linux-x86_64.sh + +# Minimal dependencies, will not enable all functionality +# Some of these already exist in the rocker image, but install +# anyway in case base image changes +RUN R_REMOTES_NO_ERRORS_FROM_WARNINGS=true \ + Rscript -e "install.packages( \ + c('Rcpp', \ + 'RcppEigen', \ + 'magrittr', \ + 'rsvd', \ + 'magic', \ + 'psych'), dependencies = TRUE )" + +RUN R CMD INSTALL ITKR && \ + R CMD INSTALL ANTsRCore && \ + R CMD INSTALL ANTsR + +# Some packages were removed from CRAN and need a github install +RUN R_REMOTES_NO_ERRORS_FROM_WARNINGS=true \ + Rscript -e "library(devtools)" \ + -e "install_github('cran/ifultools')" \ + -e "install_github('cran/DMwR')" + +RUN R_REMOTES_NO_ERRORS_FROM_WARNINGS=true \ + Rscript -e "\ + install.packages(c( \ + 'abind', \ + 'BGLR', \ + 'caret', \ + 'cluster', \ + 'corpcor', \ + 'dplyr', \ + 'e1071', \ + 'extremevalues', \ + 'fastICA', \ + 'FNN', \ + 'fpc', \ + 'ggplot2', \ + 'glasso', \ + 'glmnet', \ + 'grid', \ + 'hdf5r', \ + 'igraph', \ + 'irlba', \ + 'knitr', \ + 'mFilter', \ + 'misc3d', \ + 'moments', \ + 'networkD3', \ + 'pixmap', \ + 'png', \ + 'pracma', \ + 'R.matlab', \ + 'randomForest', \ + 'RcppHNSW', \ + 'rgl', \ + 'rmarkdown', \ + 'robust', \ + 'robustbase', \ + 'signal', \ + 'sna', \ + 'testthat', \ + 'viridis', \ + 'visreg', \ + 'wmtsa', \ + 'xgboost' \ + ), repos = 'https://cloud.r-project.org')" + +# Additional dependencies +# Derived from remotes::local_package_deps +FROM rocker/tidyverse:4.2.3 AS runtime + +COPY --from=builder /usr/local/lib/R/site-library/ /usr/local/lib/R/site-library/ + +ENV R_DEFAULT_PACKAGES="datasets,utils,grDevices,graphics,stats,methods,ANTsR" +ENV ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1 + +WORKDIR / + +CMD ["R"] diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 903dcb067..000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -FROM ubuntu:bionic-20200713 - -# Default to build latest version -ARG antsr_version="HEAD" - -# Dependencies option. Defaults to "TRUE" for everything -# Set to NA to get a smaller set of essentials -ARG antsr_dependencies=TRUE - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - apt-transport-https \ - build-essential \ - ca-certificates \ - curl \ - file \ - git \ - gnupg \ - libcurl4-gnutls-dev \ - libssl-dev \ - libxml2-dev \ - tcl \ - tcl-dev \ - tk \ - tk-dev \ - wget - -# add R stuff for apt -# https://cran.r-project.org/bin/linux/ubuntu/README.html -COPY ubuntuRKey.txt /opt - -RUN echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/" >> /etc/apt/sources.list && \ - apt-key add /opt/ubuntuRKey.txt && \ - apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - r-base \ - r-base-dev && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -RUN Rscript -e "install.packages(\"devtools\", repos = \"https://cloud.r-project.org\", dependencies = T)" \ - -e "library(devtools)" \ - -e "install_github(\"stnava/cmaker\")" -# Saves build time but can merge these layers once build is stable -# -# The warnings variable is needed to suppress warnings from tcltk that turn into an -# error about not finding DISPLAY -# -# Also suppresses missing dependencies -RUN R_REMOTES_NO_ERRORS_FROM_WARNINGS=true Rscript -e "library(devtools)" \ - -e "install_github(\"cran/ifultools\")" \ - -e "install_github(\"ANTsX/ANTsR\", ref=\"${antsr_version}\", dependencies=${antsr_dependencies})" - -ENV R_DEFAULT_PACKAGES="datasets,utils,grDevices,graphics,stats,methods,ANTsR" -ENV ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1 - - -CMD ["R"] diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 8701a18c3..000000000 --- a/docker/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# ANTsR docker - -This Dockerfile builds ANTsR using "method1" as described in the main README, -with devtools and install_github. - -## Building and version information - -The default is to build the main branch HEAD. You can build a specific version -using build args (from ANTsR/docker): - -``` -docker build --build-arg antsr_version="v0.5.6.4" -t antsr . -``` - -This allows you to control the ANTsR version, but ITKR and ANTsRCore will be -built from the latest commit. - -From within the container, find the version of all packages and dependencies -with - -``` -sessioninfo::package_info("ANTsR") -``` - -By default, all dependencies are included. To build a minimal set of -dependencies, run - -``` -docker build --build-arg antsr_dependencies=NA -t antsr . -``` - -## Running R or Rscript - -To run R interactively: - -``` -docker run --rm -it antsr -``` - -To run Rscript: - -``` -docker run --rm antsr Rscript -e 'print("Hello")' -``` - -## Controlling threads - -The default number of threads is 1, override by passing the -`ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS` variable, eg - -``` -docker run -e ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=2 ... -``` - diff --git a/docker/ubuntuRKey.txt b/docker/ubuntuRKey.txt deleted file mode 100644 index 6f4683838..000000000 --- a/docker/ubuntuRKey.txt +++ /dev/null @@ -1,40 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: SKS 1.1.6 -Comment: Hostname: keyserver.ubuntu.com - -mQENBEy9tcUBCACnWQfqdrcz7tQL/iCeWDYSYPwXp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