Skip to content

Commit 9e2fdaf

Browse files
Merge pull request #64 from yuvipanda/rstudio
Add RStudio to the base image
2 parents 6eb075e + 94f03f3 commit 9e2fdaf

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

images/singleuser/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ RUN apt-get install --yes \
7171
vim \
7272
mariadb-client > /dev/null
7373

74+
75+
# Needed by RStudio
76+
RUN apt-get update -qq --yes && \
77+
apt-get install --yes --no-install-recommends -qq \
78+
psmisc \
79+
sudo \
80+
libapparmor1 \
81+
lsb-release \
82+
libclang-dev > /dev/null
83+
# Install RStudio
84+
# 1.3.959 is latest version that works with jupyter-rsession-proxy
85+
# See https://github.com/jupyterhub/jupyter-rsession-proxy/issues/93#issuecomment-725874693
86+
ENV RSTUDIO_URL https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.959-amd64.deb
87+
RUN curl --silent --location --fail ${RSTUDIO_URL} > /tmp/rstudio.deb && \
88+
dpkg -i /tmp/rstudio.deb && \
89+
rm /tmp/rstudio.deb
90+
91+
7492
# Machine-learning type stuff
7593
RUN apt-get install --yes \
7694
# For scipy & friends
@@ -102,6 +120,14 @@ RUN apt-get install --yes \
102120
ENV R_LIBS_USER /srv/r
103121
RUN install -d -o ${NB_USER} -g ${NB_USER} ${R_LIBS_USER}
104122

123+
# R_LIBS_USER is set by default in /etc/R/Renviron, which RStudio loads.
124+
# We uncomment the default, and set what we wanna - so it picks up
125+
# the packages we install. Without this, RStudio doesn't see the packages
126+
# that R does.
127+
# Stolen from https://github.com/jupyterhub/repo2docker/blob/6a07a48b2df48168685bb0f993d2a12bd86e23bf/repo2docker/buildpacks/r.py
128+
RUN sed -i -e '/^R_LIBS_USER=/s/^/#/' /etc/R/Renviron && \
129+
echo "R_LIBS_USER=${R_LIBS_USER}" >> /etc/R/Renviron
130+
105131
# Create venv directory, and let users install into it
106132
ENV VENV_DIR /srv/paws
107133
RUN install -d -o ${NB_USER} -g ${NB_USER} ${VENV_DIR}
@@ -123,6 +149,9 @@ RUN python -m bash_kernel.install --sys-prefix
123149

124150
# Set CRAN mirror to rspm before we install anything
125151
COPY Rprofile.site /usr/lib/R/etc/Rprofile.site
152+
# RStudio needs its own config
153+
COPY rsession.conf /etc/rstudio/rsession.conf
154+
126155

127156
# Install the R Kernel
128157
RUN r -e "install.packages('IRkernel', version='1.1.1')" && \

images/singleuser/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ mycli
3636

3737
# Interface with other languages
3838
rpy2
39+
40+
# RStudio
41+
jupyter-rsession-proxy

images/singleuser/rsession.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Use binary packages!
2+
r-cran-repos=https://packagemanager.rstudio.com/all/__linux__/focal/latest

0 commit comments

Comments
 (0)