@@ -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
7593RUN apt-get install --yes \
7694 # For scipy & friends
@@ -102,6 +120,14 @@ RUN apt-get install --yes \
102120ENV R_LIBS_USER /srv/r
103121RUN 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
106132ENV VENV_DIR /srv/paws
107133RUN 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
125151COPY 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
128157RUN r -e "install.packages('IRkernel', version='1.1.1')" && \
0 commit comments