11# syntax=docker/dockerfile:1
2- FROM rocker/rstudio:4.2 .1
2+ FROM rocker/rstudio:4.4 .1
33MAINTAINER Lee Evans <evans@ohdsi.org>
44
55# install OS dependencies including java and python 3
6- RUN apt-get update && apt-get install -y openjdk-11-jdk liblzma-dev libbz2-dev libncurses5-dev curl python3-dev python3.venv \
6+ RUN apt-get update && apt-get install -y openjdk-11-jdk liblzma-dev libbz2-dev libncurses5-dev curl python3-dev python3.venv python3-pip cmake libfontconfig-dev libsodium-dev libxml2-dev \
77&& R CMD javareconf \
88&& rm -rf /var/lib/apt/lists/*
99
10- # install utility R packages
11- RUN install2.r \
12- openssl \
13- httr \
14- xml2 \
15- remotes \
16- && rm -rf /tmp/download_packages/ /tmp/*.rds
10+ COPY strategus_template/renv.lock /home/rstudio/renv.lock
11+
12+ WORKDIR /home/rstudio/
1713
1814# install OHDSI HADES R packages from CRAN and GitHub, temporarily adding a GitHub Personal Access Token (PAT) to the Renviron file
19- RUN --mount=type=secret,id=build_github_pat \
15+ RUN --mount=type=secret,id=github_build_pat \
2016 cp /usr/local/lib/R/etc/Renviron /tmp/Renviron \
21- && echo "GITHUB_PAT=$(cat /run/secrets/build_github_pat)" >> /usr/local/lib/R/etc/Renviron \
22- && R -e "remotes::install_github(repo = 'OHDSI/Hades', upgrade = 'always')" \
23- && cp /tmp/Renviron /usr/local/lib/R/etc/Renviron
17+ && echo "GITHUB_PAT=$(cat /run/secrets/github_build_pat)" >> /usr/local/lib/R/etc/Renviron \
18+ && R -e "install.packages('renv')" \
19+ && R -e "renv::install('curl@5.2.3')" \
20+ && R -e "renv::restore(clean = FALSE, prompt = FALSE)" \
21+ && R -e "renv::install('OHDSI/Eunomia')" \
22+ && cp /tmp/Renviron /usr/local/lib/R/etc/Renviron \
23+ && rm -rf /tmp/download_packages/ /tmp/*.rds
2424
2525# install useful R libraries to help RStudio users to create/use their own GitHub Personal Access Token
2626RUN install2.r \
2727 usethis \
2828 gitcreds \
29- && rm -rf /tmp/download_packages/ /tmp/*.rds
29+ && rm -rf /tmp/download_packages/ /tmp/*.rds /home/rstudio/renv.lock
3030
3131# create Python virtual environment used by the OHDSI PatientLevelPrediction R package
3232ENV WORKON_HOME="/opt/.virtualenvs"
@@ -51,7 +51,8 @@ RUN install2.r \
5151
5252# install the jdbc drivers for database access using the OHDSI DatabaseConnector R package
5353ENV DATABASECONNECTOR_JAR_FOLDER="/opt/hades/jdbc_drivers"
54- RUN R -e "DatabaseConnector::downloadJdbcDrivers('all');"
54+ RUN mkdir /opt/hades/ \
55+ && R -e "DatabaseConnector::downloadJdbcDrivers('all');"
5556
5657# Install Rserve server and client
5758RUN install2.r \
@@ -70,6 +71,17 @@ EXPOSE 6311
7071# install supervisor process controller
7172RUN apt-get update && apt-get install -y supervisor
7273
74+ COPY strategus_template/StrategusStudyRepoTemplate-main.zip /tmp/StrategusStudyRepoTemplate-main.zip
75+
76+ RUN echo "RENV_PATHS_CACHE=/root/.cache/R/renv/cache" >> /usr/local/lib/R/etc/Renviron.site \
77+ && unzip -o -d /home/ /tmp/StrategusStudyRepoTemplate-main.zip \
78+ && chmod -R a+rwx /home/StrategusStudyRepoTemplate-main \
79+ && chmod -R a+rwx /home/StrategusStudyRepoTemplate-main/StrategusStudyRepoTemplate.Rproj \
80+ && rm -r /home/StrategusStudyRepoTemplate-main/renv \
81+ && chmod a+rwx /root/ \
82+ && chmod -R a+rwx /root/.cache/R/renv/cache \
83+ && rm /tmp/StrategusStudyRepoTemplate-main.zip
84+
7385# start Rserve & RStudio using supervisor
7486RUN echo "" >> /etc/supervisor/conf.d/supervisord.conf \
7587 && echo "[supervisord]" >> /etc/supervisor/conf.d/supervisord.conf \
@@ -82,6 +94,8 @@ RUN echo "" >> /etc/supervisor/conf.d/supervisord.conf \
8294 && echo "command=/init" >> /etc/supervisor/conf.d/supervisord.conf \
8395 && echo "" >> /etc/supervisor/conf.d/supervisord.conf \
8496 && echo "stdout_logfile=/var/log/supervisor/%(program_name)s.log" >> /etc/supervisor/conf.d/supervisord.conf \
85- && echo "stderr_logfile=/var/log/supervisor/%(program_name)s.log" >> /etc/supervisor/conf.d/supervisord.conf
97+ && echo "stderr_logfile=/var/log/supervisor/%(program_name)s.log" >> /etc/supervisor/conf.d/supervisord.conf
98+
99+ WORKDIR /
86100
87101CMD ["/usr/bin/supervisord" , "-c" , "/etc/supervisor/conf.d/supervisord.conf" ]
0 commit comments