Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add RStudio to the base image
Uses github.com/jupyterhub/jupyter-rsession-proxy/ to provide
RStudio :)

You can test this with:

$ docker build -t paws images/singleuser
$ docker run -p 8888:8888 paws jupyter notebook --ip=0.0.0.0

This should start a notebook server, and print a URL with a token
you can use to connect to the docker container & test the image.
Since this uses port forwarding, it'll most likely only work if you
are running docker locally (and not via docker-machine)
  • Loading branch information
yuvipanda committed May 22, 2021
commit 94f03f3fd7a733492bc252aab7058c4fe83a8a56
29 changes: 29 additions & 0 deletions images/singleuser/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ RUN apt-get install --yes \
vim \
mariadb-client > /dev/null


# Needed by RStudio
RUN apt-get update -qq --yes && \
apt-get install --yes --no-install-recommends -qq \
psmisc \
sudo \
libapparmor1 \
lsb-release \
libclang-dev > /dev/null
# Install RStudio
# 1.3.959 is latest version that works with jupyter-rsession-proxy
# See https://github.com/jupyterhub/jupyter-rsession-proxy/issues/93#issuecomment-725874693
ENV RSTUDIO_URL https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.959-amd64.deb
RUN curl --silent --location --fail ${RSTUDIO_URL} > /tmp/rstudio.deb && \
dpkg -i /tmp/rstudio.deb && \
rm /tmp/rstudio.deb


# Machine-learning type stuff
RUN apt-get install --yes \
# For scipy & friends
Expand Down Expand Up @@ -102,6 +120,14 @@ RUN apt-get install --yes \
ENV R_LIBS_USER /srv/r
RUN install -d -o ${NB_USER} -g ${NB_USER} ${R_LIBS_USER}

# R_LIBS_USER is set by default in /etc/R/Renviron, which RStudio loads.
# We uncomment the default, and set what we wanna - so it picks up
# the packages we install. Without this, RStudio doesn't see the packages
# that R does.
# Stolen from https://github.com/jupyterhub/repo2docker/blob/6a07a48b2df48168685bb0f993d2a12bd86e23bf/repo2docker/buildpacks/r.py
RUN sed -i -e '/^R_LIBS_USER=/s/^/#/' /etc/R/Renviron && \
echo "R_LIBS_USER=${R_LIBS_USER}" >> /etc/R/Renviron

# Create venv directory, and let users install into it
ENV VENV_DIR /srv/paws
RUN install -d -o ${NB_USER} -g ${NB_USER} ${VENV_DIR}
Expand All @@ -123,6 +149,9 @@ RUN python -m bash_kernel.install --sys-prefix

# Set CRAN mirror to rspm before we install anything
COPY Rprofile.site /usr/lib/R/etc/Rprofile.site
# RStudio needs its own config
COPY rsession.conf /etc/rstudio/rsession.conf


# Install the R Kernel
RUN r -e "install.packages('IRkernel', version='1.1.1')" && \
Expand Down
3 changes: 3 additions & 0 deletions images/singleuser/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ mycli

# Interface with other languages
rpy2

# RStudio
jupyter-rsession-proxy
2 changes: 2 additions & 0 deletions images/singleuser/rsession.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Use binary packages!
r-cran-repos=https://packagemanager.rstudio.com/all/__linux__/focal/latest