Skip to content

Commit 474efc9

Browse files
committed
🐳
1 parent f15c1fd commit 474efc9

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ RUN adduser "$NB_USER" sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoer
1818
RUN curl -s https://raw.githubusercontent.com/rocker-org/ml/refs/heads/master/install_r.sh | bash
1919
RUN curl -s https://raw.githubusercontent.com/rocker-org/ml/refs/heads/master/install_rstudio.sh | bash
2020

21+
# Configure Runiverse
22+
COPY Rprofile $/usr/lib/R/etc/Rprofile.site
23+
2124
## Add rstudio's binaries to path for quarto
2225
ENV PATH=$PATH:/usr/lib/rstudio-server/bin/quarto/bin
2326

install_bspm.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Fifth: install bspm (and its Python requirements) and enable it
2+
## If needed (in bare container, say) install python tools for bspm and R itself
3+
apt-get install --yes --no-install-recommends python3-{dbus,gi,apt} \
4+
make sudo r-cran-{docopt,littler,remotes}
5+
## Then install bspm (as root) and enable it, and enable a speed optimization
6+
Rscript -e 'install.packages("bspm")'
7+
8+
R_HOME=$(R RHOME)
9+
# must go first. Only configure for ROOT user
10+
echo "options(bspm.sudo = TRUE)" >> ${HOME}/.Rprofile
11+
echo "options(bspm.version.check=FALSE)" >> ${HOME}/.Rprofile
12+
echo "suppressMessages(bspm::enable())" >> ${HOME}/.Rprofile
13+
14+
chown root:users ${R_HOME}/site-library
15+
chmod g+ws ${R_HOME}/site-library
16+
17+

install_r.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# determine Ubuntu release
4+
source /etc/os-release
5+
6+
## First: update apt and get keys
7+
apt-get update -qq && apt-get install --yes --no-install-recommends wget ca-certificates gnupg
8+
wget -q -O- https://eddelbuettel.github.io/r2u/assets/dirk_eddelbuettel_key.asc \
9+
| tee -a /etc/apt/trusted.gpg.d/cranapt_key.asc
10+
11+
## Second: add the repo -- here we use the well-connected mirror
12+
echo "deb [arch=amd64] https://r2u.stat.illinois.edu/ubuntu ${UBUNTU_CODENAME} main" > /etc/apt/sources.list.d/cranapt.list
13+
apt-get update
14+
15+
## Third: ensure current R is used
16+
wget -q -O- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
17+
| tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
18+
echo "deb [arch=amd64] https://cloud.r-project.org/bin/linux/ubuntu ${UBUNTU_CODENAME}-cran40/" > /etc/apt/sources.list.d/cran_r.list
19+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 67C2D66C4B1D4339 51716619E084DAB9
20+
apt-get update -qq
21+
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends r-base r-base-dev r-recommended
22+
23+
## Fourth: add pinning to ensure package sorting
24+
echo "Package: *" > /etc/apt/preferences.d/99cranapt
25+
echo "Pin: release o=CRAN-Apt Project" >> /etc/apt/preferences.d/99cranapt
26+
echo "Pin: release l=CRAN-Apt Packages" >> /etc/apt/preferences.d/99cranapt
27+
echo "Pin-Priority: 700" >> /etc/apt/preferences.d/99cranapt
28+
29+
chown root:users ${R_HOME}/site-library
30+
chmod g+ws ${R_HOME}/site-library
31+
32+
ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r
33+
34+
## add user to sudoers -- not jupyterhub compatible
35+
# usermod -a -G staff ${NB_USER}
36+
# echo "${NB_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
37+
38+

0 commit comments

Comments
 (0)