-
Notifications
You must be signed in to change notification settings - Fork 3
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 #322 from hms-dbmi-cellenics/fast-build
implement fast restore
- Loading branch information
Showing
6 changed files
with
322 additions
and
23 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
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 |
---|---|---|
|
@@ -13,27 +13,28 @@ ARG GITHUB_PAT | |
ENV GITHUB_PAT $GITHUB_PAT | ||
RUN R -q -e "if(Sys.getenv('GITHUB_PAT') == '') stop('need to export GITHUB_PAT')" | ||
|
||
# renv library | ||
ENV RENV_LIB=/src/lib | ||
|
||
# add renv library to .libPaths | ||
# this is path with R package folders when renv deactivated or not used | ||
ENV RENV_LIB=/src/lib | ||
RUN echo ".libPaths(c('$RENV_LIB', .libPaths()))" >> $(R RHOME)/etc/Rprofile.site | ||
|
||
# install renv to install required R packages | ||
RUN R -q -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" && \ | ||
R -q -e "remotes::install_github('rstudio/[email protected]')" && \ | ||
R -q -e "renv::init(bare = TRUE, settings = list(use.cache = FALSE))" | ||
|
||
# fast pre-restore with pkgbuild | ||
# an initial lockfile is used to avoid frequent re-installs | ||
# use renv::snapshot(lockfile='renv.lock.init') if R dependency updates become slow to build | ||
# delete renv cache | ||
# strip debug from shared libraries | ||
# see http://dirk.eddelbuettel.com/blog/2017/08/20/#010_stripping_shared_libraries | ||
COPY ./renv.lock.init . | ||
RUN R -q -e "renv::restore(lockfile='renv.lock.init', library = '$RENV_LIB')" && \ | ||
R -q -e 'root <- renv::paths$root(); unlink(root, recursive = TRUE)' && \ | ||
strip --strip-debug $RENV_LIB/*/libs/*.so | ||
# copy renv.lock.init to renv.lock if R dependency updates become slow to build | ||
COPY ./renv.lock.init ./renv.lock | ||
COPY setup/restore_fast.R . | ||
RUN Rscript restore_fast.R | ||
|
||
# restore anything pkgbuild missed | ||
COPY setup/restore_renv.R . | ||
RUN Rscript restore_renv.R | ||
|
||
# deactivate so that .libPaths used (set above) | ||
RUN R -q -e "renv::deactivate()" | ||
|
||
# install miniconda and geosketch | ||
|
@@ -46,9 +47,7 @@ RUN R -q -e "reticulate::install_miniconda()" && \ | |
|
||
# use renv::snapshot() while R dependency updates are quick to build | ||
COPY ./renv.lock . | ||
RUN R -q -e "renv::restore(lockfile='renv.lock', library = '$RENV_LIB', clean = TRUE)" && \ | ||
R -q -e 'root <- renv::paths$root(); unlink(root, recursive = TRUE)' && \ | ||
strip --strip-debug $RENV_LIB/*/libs/*.so | ||
RUN Rscript restore_renv.R | ||
|
||
# determine system run-time deps | ||
COPY setup/get_sysdeps_run.R . | ||
|
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
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
Oops, something went wrong.