Skip to content

Commit

Permalink
🙊
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Sep 27, 2024
1 parent e201acc commit 15cac5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ RUN conda env update -f environment.yml
COPY install.r install.r
RUN Rscript install.r

# regular user shouldn't default to bspm
RUN sed -i 's/^suppressMessages(bspm::enable())//' /usr/lib/R/etc/Rprofile.site
USER ${NB_USER}

12 changes: 6 additions & 6 deletions install_r.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/bin/bash

## First: update apt and get keys
apt update -qq && apt install --yes --no-install-recommends wget ca-certificates gnupg
apt-get update -qq && apt-get install --yes --no-install-recommends wget ca-certificates gnupg
wget -q -O- https://eddelbuettel.github.io/r2u/assets/dirk_eddelbuettel_key.asc \
| tee -a /etc/apt/trusted.gpg.d/cranapt_key.asc

## Second: add the repo -- here we use the well-connected mirror
echo "deb [arch=amd64] https://r2u.stat.illinois.edu/ubuntu noble main" > /etc/apt/sources.list.d/cranapt.list
apt update
apt-get update

## Third: ensure current R is used
wget -q -O- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
| tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
echo "deb [arch=amd64] https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/" > /etc/apt/sources.list.d/cran_r.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 67C2D66C4B1D4339 51716619E084DAB9
apt update -qq
DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends r-base r-base-dev r-recommended
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends r-base r-base-dev r-recommended

## Fourth: add pinning to ensure package sorting
echo "Package: *" > /etc/apt/preferences.d/99cranapt
Expand All @@ -25,7 +25,7 @@ echo "Pin-Priority: 700" >> /etc/apt/preferences.d/99cranapt

## Fifth: install bspm (and its Python requirements) and enable it
## If needed (in bare container, say) install python tools for bspm and R itself
apt install --yes --no-install-recommends python3-{dbus,gi,apt} \
apt-get install --yes --no-install-recommends python3-{dbus,gi,apt} \
make sudo r-cran-{docopt,littler,remotes}
## Then install bspm (as root) and enable it, and enable a speed optimization
Rscript -e 'install.packages("bspm")'
Expand All @@ -35,7 +35,7 @@ echo "options(bspm.version.check=FALSE)" >> ${RHOME}/etc/Rprofile.site

chown root:staff ${RHOME}/site-library
chmod g+ws ${RHOME}/site-library
echo "options('bspm.sudo' = TRUE)" >> ${RHOME}/etc/Rprofile.site
echo "options(bspm.sudo = TRUE)" >> ${RHOME}/etc/Rprofile.site


ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r
Expand Down

0 comments on commit 15cac5a

Please sign in to comment.