From f041116723595459c196e3299d5689995a4808ed Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 29 Mar 2022 12:43:39 +0200 Subject: [PATCH] Added more compilation steps. --- 03_setup_root_path.sh | 11 +++++++++++ 04_copy_env.sh | 3 +++ 05_setup_rsession_parameters.sh | 13 +++++++++++++ Dockerfile | 34 ++++++++++++++++++++++++++++++++- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 03_setup_root_path.sh create mode 100644 04_copy_env.sh create mode 100644 05_setup_rsession_parameters.sh diff --git a/03_setup_root_path.sh b/03_setup_root_path.sh new file mode 100644 index 0000000..e282d68 --- /dev/null +++ b/03_setup_root_path.sh @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash + +echo "root path: $WWW_ROOT_PATH" + +if [[ ! -z $WWW_ROOT_PATH ]] +then + echo "Set www-root-path to $WWW_ROOT_PATH" + echo "www-root-path=$WWW_ROOT_PATH" >> /etc/rstudio/rserver.conf +else + echo "Not setting www-root-path" +fi diff --git a/04_copy_env.sh b/04_copy_env.sh new file mode 100644 index 0000000..b8e0984 --- /dev/null +++ b/04_copy_env.sh @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +printenv >> /home/$USER/.Renviron diff --git a/05_setup_rsession_parameters.sh b/05_setup_rsession_parameters.sh new file mode 100644 index 0000000..64423b6 --- /dev/null +++ b/05_setup_rsession_parameters.sh @@ -0,0 +1,13 @@ +#!/usr/bin/with-contenv bash + +echo "session-timeout-minutes=360" >> /etc/rstudio/rsession.conf +echo "session-disconnected-timeout-minutes=360" >> /etc/rstudio/rsession.conf +echo "session-quit-child-processes-on-exit=0" >> /etc/rstudio/rsession.conf +echo "session-default-working-dir=~" >> /etc/rstudio/rsession.conf +echo "session-default-new-project-dir=~" >> /etc/rstudio/rsession.conf +echo "session-save-action-default=yes" >> /etc/rstudio/rsession.conf +echo "allow-shell=0" >> /etc/rstudio/rsession.conf +echo "allow-terminal-websockets=1" >> /etc/rstudio/rsession.conf +echo "limit-cpu-time-minutes=0" >> /etc/rstudio/rsession.conf +echo "limit-file-upload-size-mb=0" >> /etc/rstudio/rsession.conf +echo "limit-xfs-disk-quota=no" >> /etc/rstudio/rsession.conf diff --git a/Dockerfile b/Dockerfile index 37b9042..24e3f68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,41 @@ ENV DEFAULT_USER=rstudio ENV PANDOC_VERSION=default ENV PATH=/usr/lib/rstudio-server/bin:$PATH +# Install OpenJDK +RUN apt-get update && apt-get install -y openjdk-8-jdk-headless openjdk-8-jre-headless + +# Install a lot of R packages +ADD https://code-repo.d4science.org/gCubeSystem/r-packages-list/raw/branch/master/install2r-packages.txt /tmp +RUN for f in `cat /tmp/install2r-packages.txt` ; do install2.r --error --skipinstalled --ncpus -1 $f ; done + +# Non CRAN repositories +ADD https://code-repo.d4science.org/gCubeSystem/r-packages-list/raw/branch/master/r_non_cran_pkgs.txt /tmp +RUN for l in `cat /tmp/r_non_cran_pkgs.txt` ; do \ + pkg=`echo $l | cut -d : -f 1` ; \ + mirror=`echo $l | cut -d : -f 2-` ; \ + Rscript --slave --no-site-file --no-init-file --no-save --no-restore-history \ + -e "install.packages(pkgs='$pkg', repos=c('$mirror/'));" ; done + +# From github +ADD https://code-repo.d4science.org/gCubeSystem/r-packages-list/raw/branch/master/r_github_pkgs.txt /tmp +RUN for g in `cat /tmp/r_github_pkgs.txt` ; do \ + Rscript --slave --no-site-file --no-init-file --no-save --no-restore-history \ + -e " require(devtools); devtools::install_github('$g')" ; done + RUN /rocker_scripts/install_rstudio.sh RUN /rocker_scripts/install_pandoc.sh +# This part comes from https://github.com/openanalytics/shinyproxy-rstudio-ide-demo/blob/master/Dockerfile +RUN echo "www-frame-origin=disabled" >> /etc/rstudio/disable_auth_rserver.conf +RUN echo "www-verify-user-agent=0" >> /etc/rstudio/disable_auth_rserver.conf + +ADD 03_setup_root_path.sh /etc/cont-init.d/03_setup_root_path.sh + +# By default RStudio does not give access to all enviornment variables defined in the container (e.g. using ShinyProxy). +# Uncomment the next line, to change this behavior. +ADD 04_copy_env.sh /etc/cont-init.d/04_copy_env.sh +ADD 05_setup_rsession_parameters.sh /etc/cont-init.d/05_setup_rsession_parameters.sh + EXPOSE 8787 -CMD ["/init"] \ No newline at end of file +CMD ["/init"]