diff --git a/deployments/datahub/images/default/Dockerfile b/deployments/datahub/images/default/Dockerfile index d97f276e3..29f185043 100644 --- a/deployments/datahub/images/default/Dockerfile +++ b/deployments/datahub/images/default/Dockerfile @@ -57,8 +57,10 @@ RUN curl --silent --location --fail ${SHINY_SERVER_URL} > /tmp/shiny-server.deb apt install --no-install-recommends --yes /tmp/shiny-server.deb && \ rm /tmp/shiny-server.deb -# Set CRAN mirror to rspm before we install anything +# Install our custom Rprofile.site file COPY Rprofile.site /usr/lib/R/etc/Rprofile.site +# Create directory for additional R/RStudio setup code +RUN mkdir /etc/R/Rprofile.site.d # RStudio needs its own config COPY rsession.conf /etc/rstudio/rsession.conf diff --git a/deployments/datahub/images/default/Rprofile.site b/deployments/datahub/images/default/Rprofile.site index b83424b51..5cf15ca99 100644 --- a/deployments/datahub/images/default/Rprofile.site +++ b/deployments/datahub/images/default/Rprofile.site @@ -16,4 +16,21 @@ options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/jammy # below sets it to be binary. This may improve image build times. # If it works, it'd be better to dynamically set the R version as above, and # also the RStudio Server version if possible. -options(HTTPUserAgent = "RStudio Server (2021.9.1.372); R (4.3.1 x86_64-pc-linux-gnu x86_64 linux-gnu)") +options(HTTPUserAgent = "RStudio Server (2023.12.0.369); R (4.3.2 x86_64-pc-linux-gnu x86_64 linux-gnu)") + + +## Source extra Rprofile files. +# +# This lets us easily add new code via extraFiles (or other z2jh-related +# magic) without having to rebuild the image each time. + +# Get a list of files in the directory +rprofile_dir <- "/etc/R/Rprofile.site.d/" +rprofile_files <- list.files(rprofile_dir, full.names = TRUE) + +# Source each file +for (rprofile_file in rprofile_files) { + cat("Sourcing:", rprofile_file, "\n") + source(rprofile_file) +} +