Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions r/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,24 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Install BigelowLab dev R libs
# RUN installGithub.R BigelowLab/rasf BigelowLab/ohwobpg # not working on GH but works locally :-/
RUN Rscript -e "remotes::install_cran('assertthat', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_cran('ggspatial', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_cran('plot.matrix', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_cran('isdparser', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_cran('geonames', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_cran('rnoaa', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('hadley/emo', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/ohwobpg', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/rasf', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/xyzt', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/ghrsst', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/bsw', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/ersst', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('BigelowLab/hycom', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
Rscript -e "remotes::install_github('kwstat/pals', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)"
#RUN Rscript -e "remotes::install_cran('assertthat', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_cran('ggspatial', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_cran('plot.matrix', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_cran('isdparser', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_cran('geonames', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_cran('rnoaa', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('hadley/emo', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/ohwobpg', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/rasf', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/xyzt', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/ghrsst', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/bsw', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/ersst', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('BigelowLab/hycom', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)" && \
# Rscript -e "remotes::install_github('kwstat/pals', dependencies=FALSE, upgrade_dependencies=FALSE, upgrade=FALSE)"
COPY ./install.R ./remotes.yml ./

RUN Rscript install.R remotes.yml

COPY CONDARC ./.condarc

Expand Down
45 changes: 45 additions & 0 deletions r/install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Install one or more R packages using remotes package
#
# Input/Output:
# @param single argument with fully qualified name to (yaml) configuration file
# @return 0 for success, non-zero if an issue arises. Fails soon.
#
# Usage:
# Rscript /path/to/install.R /path/to/remotes.yml
#
library(yaml)
library(remotes)

x <- yaml::read_yaml(commandArgs(trailingOnly = TRUE)[1])

args <- x$extra

if ('install_cran' %in% names(x)){
for (p in x[['install_cran']]){
ok <- try(remotes::install_cran(p,
dependencies=args$dependencies,
upgrade_dependencies=args$upgrade_dependencies,
upgrade=args$upgrade))
if (inherits(ok, 'try-error')){
print("unable to install package:", p)
print(ok)
quit(save = "no", status = 1)
}
}
}

if ('install_github' %in% names(x)){
for (p in x[['install_github']]){
ok <- try(remotes::install_github(p,
dependencies=args$dependencies,
upgrade_dependencies=args$upgrade_dependencies,
upgrade=args$upgrade))
if (inherits(ok, 'try-error')){

print(ok)
quit(save = "no", status = 1)
}
}
}

quit(save = "no", status = 0)
22 changes: 22 additions & 0 deletions r/remotes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extra:
dependencies: no
upgrade_dependencies: no
upgrade: no
install_cran:
- assertthat
- ggspatial
- plot.matrix
- isdparser
- geonames
- rnoaa
install_github:
- hadley/emo
- BigelowLab/ohwobpg
- BigelowLab/rasf
- BigelowLab/xyzt
- BigelowLab/ghrsst
- BigelowLab/bsw
- BigelowLab/ersst
- BigelowLab/ersst
- BigelowLab/hycom
- kwstat/pals