From 596adef606b057df3365e0f582a548adc9c84fdb Mon Sep 17 00:00:00 2001 From: eldrid01 Date: Tue, 15 Jun 2021 17:40:09 +0100 Subject: [PATCH] Install R using CRAN Debian package, no longer need to specify repo for R packages (defaults to cloud.r-project.org), added optparse R package --- docker/Dockerfile | 60 +++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7c9a3bf..13205d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,38 +2,61 @@ FROM debian:buster-20210511-slim MAINTAINER Matt Eldridge "matthew.eldridge@cruk.cam.ac.uk" +ARG DEBIAN_FRONTEND=noninteractive + RUN apt-get update +RUN apt-get install -y apt-utils + +# update locale +RUN apt-get install -y locales +RUN sed -i 's/^# en_GB/en_GB/' /etc/locale.gen +RUN locale-gen + +# install packages and libraries needed to build/install Shiny server, R and +# R packages/dependencies RUN apt-get install -y build-essential RUN apt-get install -y libxml2-dev RUN apt-get install -y libssl-dev RUN apt-get install -y libreadline7 +RUN apt-get install -y libcurl4-openssl-dev RUN apt-get install -y curl RUN apt-get install -y gdebi-core RUN apt-get clean -# install R -ARG R_VERSION=4.1.0 -RUN curl -O https://cdn.rstudio.com/r/debian-10/pkgs/r-${R_VERSION}_1_amd64.deb -RUN gdebi -n r-${R_VERSION}_1_amd64.deb -RUN rm r-${R_VERSION}_1_amd64.deb -RUN ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R -RUN ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript - # install Shiny server ARG SHINY_SERVER_VERSION=1.5.16.958-amd64 RUN curl -O https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-${SHINY_SERVER_VERSION}.deb RUN gdebi -n shiny-server-${SHINY_SERVER_VERSION}.deb RUN rm shiny-server-${SHINY_SERVER_VERSION}.deb +# expose port that Shiny server listens on (can be mapped to another port on the host) +EXPOSE 3838 + +# ensure the user account that is running the shiny server process has write privilege for /var/lib/shiny-server +RUN chmod ugo+rwx /var/lib/shiny-server + +# command to run when starting the container using 'docker run' +CMD exec shiny-server >> /var/log/shiny-server/shiny-server.log 2>&1 + +# install R +RUN apt-key adv --keyserver keys.gnupg.net --recv-key E19F5F87128899B192B1A2C2AD5F960A256A04AF +RUN echo 'deb http://cloud.r-project.org/bin/linux/debian buster-cran40/' >> /etc/apt/sources.list +RUN apt-get update +RUN apt-get install -y -t buster-cran40 r-base + +# update pre-installed R packages +RUN R -e 'update.packages(ask = FALSE)' + # install R packages -RUN R -e 'install.packages("shiny", repos = "https://cloud.r-project.org")' -RUN R -e 'install.packages("tidyverse", repos = "https://cloud.r-project.org")' -RUN R -e 'install.packages("DT", repos = "https://cloud.r-project.org")' -RUN R -e 'install.packages("shinyjs", repos = "https://cloud.r-project.org")' -RUN R -e 'install.packages("colourpicker", repos = "https://cloud.r-project.org")' +RUN R -e 'install.packages("tidyverse")' +RUN R -e 'install.packages("optparse")' +RUN R -e 'install.packages("shiny")' +RUN R -e 'install.packages("shinyjs")' +RUN R -e 'install.packages("colourpicker")' +RUN R -e 'install.packages("DT")' # install Bioconductor packages -RUN R -e 'install.packages("BiocManager", repos = "https://cloud.r-project.org")' +RUN R -e 'install.packages("BiocManager")' RUN R -e 'BiocManager::install("Biobase")' RUN R -e 'BiocManager::install("QDNAseq")' @@ -46,12 +69,3 @@ RUN R CMD INSTALL /opt/rascal_${RASCAL_VERSION}.tgz RUN tar zxf /opt/rascal_${RASCAL_VERSION}.tgz -C /opt RUN ln -s /opt/rascal/shiny /srv/shiny-server/rascal -# ensure the user account that is running the shiny server process has write privilege for /var/lib/shiny-server -RUN chmod ugo+rwx /var/lib/shiny-server - -# expose port that Shiny server listens on (can be mapped to another port on the host) -EXPOSE 3838 - -# command to run when starting the container using 'docker run' -CMD exec shiny-server >> /var/log/shiny-server/shiny-server.log 2>&1 -