Skip to content

Commit

Permalink
ENH: Update docker file (#384)
Browse files Browse the repository at this point in the history
Multiple improvements:

* Use rocker base image with R pre-installed, saves time and effort dealing with manual install
* Follow Dockerfile convention for placement of file, uses local source to build
* Switch to R CMD INSTALL, because devtools install is not working on recent versions
  • Loading branch information
cookpa authored May 12, 2023
1 parent 9df124a commit d253feb
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 152 deletions.
94 changes: 94 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
58 changes: 0 additions & 58 deletions docker/Dockerfile

This file was deleted.

54 changes: 0 additions & 54 deletions docker/README.md

This file was deleted.

40 changes: 0 additions & 40 deletions docker/ubuntuRKey.txt

This file was deleted.

0 comments on commit d253feb

Please sign in to comment.