Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IT-4004: Update dependencies; make build fail when package installations fail #9

Merged
merged 14 commits into from
Nov 13, 2024
Merged
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
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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')"

Expand Down
15 changes: 15 additions & 0 deletions install_packages_or_fail.R
Original file line number Diff line number Diff line change
@@ -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')
}
}
15 changes: 15 additions & 0 deletions install_versioned_package_or_fail.R
Original file line number Diff line number Diff line change
@@ -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')
}
Loading