diff --git a/Dockerfile b/Dockerfile index 2233b02..08333e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,17 @@ ENV DISABLE_AUTH=true RUN apt-get -y update && \ apt-get -y upgrade && \ apt-get -y install libpng-dev \ +libcurl4-openssl-dev \ +libxml2-dev \ +libfontconfig1-dev \ +libgit2-dev \ +libfontconfig1-dev \ +libfribidi-dev \ +libfreetype6-dev \ +libpng-dev \ +libtiff5-dev \ +libjpeg-dev \ +libharfbuzz-dev \ python3 \ python3-pip \ python3-venv \ @@ -20,9 +31,13 @@ USER rstudio RUN python3 -m pip install virtualenv # Install R packages -RUN R -e "install.packages(c('tidyverse','devtools','BiocManager', 'reticulate'))" +ADD install_packages_or_fail.R / +ADD install_versioned_package_or_fail.R / +# synapser depends on rjson 0.2.21, but a newer version is installed by default +RUN Rscript --no-save install_versioned_package_or_fail.R rjson 0.2.21 +RUN Rscript --no-save install_packages_or_fail.R tidyverse devtools BiocManager reticulate # Install synapser and, by extension, the synapse Python client -RUN R -e "install.packages('synapser', repos=c('http://ran.synapse.org', 'http://cran.fhcrc.org'))" +RUN Rscript --no-save install_packages_or_fail.R synapser # Install Python package boto3, which will be used by the synapse Python client RUN R -e "reticulate::virtualenv_install(reticulate::virtualenv_list()[1], 'boto3')" diff --git a/install_packages_or_fail.R b/install_packages_or_fail.R new file mode 100644 index 0000000..7ff139a --- /dev/null +++ b/install_packages_or_fail.R @@ -0,0 +1,15 @@ +#!/usr/bin/env Rscript +# from https://stackoverflow.com/questions/26244530/how-do-i-make-install-packages-return-an-error-if-an-r-package-cannot-be-install +# install the latest versions of a list of packages and fail +# if any package fails to install + +packages = commandArgs(trailingOnly=TRUE) + +for (l in packages) { + + install.packages(l, dependencies=TRUE, repos=c('http://ran.synapse.org', 'https://cran.rstudio.com')) + + if ( ! library(l, character.only=TRUE, logical.return=TRUE) ) { + quit(status=1, save='no') + } +} diff --git a/install_versioned_package_or_fail.R b/install_versioned_package_or_fail.R new file mode 100644 index 0000000..c1b824f --- /dev/null +++ b/install_versioned_package_or_fail.R @@ -0,0 +1,15 @@ +#!/usr/bin/env Rscript +# install a specific version of a given package and fail if +# the package fails to install + +theargs = commandArgs(trailingOnly=TRUE) + +package=theargs[1] +version=theargs[2] + +install.packages('remotes', dependencies=TRUE, repos='https://cran.rstudio.com') +remotes::install_version(package, version = version, repos = 'https://cran.rstudio.com') + +if ( ! library(package, character.only=TRUE, logical.return=TRUE) ) { + quit(status=1, save='no') +}