From 9685ec00bb8fff70ded5903006c772e614305e2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rok=20Ro=C5=A1kar?= <rok.roskar@sdsc.ethz.ch>
Date: Thu, 19 Mar 2020 17:17:09 +0000
Subject: [PATCH] build: support R along with python in interactive
 environments

---
 Dockerfile                 | 35 ++++++++++++++++++++++++++---------
 covid-19-public-data.Rproj | 13 +++++++++++++
 install.R                  |  0
 requirements.txt           |  1 +
 4 files changed, 40 insertions(+), 9 deletions(-)
 create mode 100644 covid-19-public-data.Rproj
 create mode 100644 install.R

diff --git a/Dockerfile b/Dockerfile
index f7fe884a..2f3cb9d7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM renku/renkulab:renku0.9.1-py3.7-0.5.2
+FROM renku/renkulab:renku0.9.1-r3.6.1-0.5.2
 
 # For some reason need to be root to install from symlink
 COPY src /code/src
@@ -8,18 +8,35 @@ RUN ln -s /code/src
 # e.g. the following installs apt-utils and vim; each pkg on its own line, all lines
 # except for the last end with backslash '\' to continue the RUN line
 #
-# USER root
-# RUN apt-get update && \
-#    apt-get install -y --no-install-recommends \
-#    apt-utils \
-#    vim
-# USER ${NB_USER}
+USER root
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    apt-utils \
+    dirmngr \
+    gpg-agent \
+    less \
+    libcurl4-openssl-dev \
+    libxml2-dev \
+    libz-dev \
+    software-properties-common
+    
+RUN chmod -R 777 /usr/local/lib/R/site-library
+    
+USER ${NB_USER}
 
 # install the python dependencies
 USER root
 COPY requirements.txt environment.yml /tmp/
 RUN conda env update -q -f /tmp/environment.yml && \
-    /opt/conda/bin/pip install -r /tmp/requirements.txt && \
+    /opt/conda/bin/pip install --ignore-installed -r /tmp/requirements.txt && \
     conda clean -y --all && \
-    conda env export -n "root"
+    conda env export -n "root" && \
+    jupyter lab build
 USER ${NB_USER}
+
+# install the R dependencies
+COPY install.R /tmp/
+RUN R -f /tmp/install.R
+
+RUN pipx upgrade renku
diff --git a/covid-19-public-data.Rproj b/covid-19-public-data.Rproj
new file mode 100644
index 00000000..8e3c2ebc
--- /dev/null
+++ b/covid-19-public-data.Rproj
@@ -0,0 +1,13 @@
+Version: 1.0
+
+RestoreWorkspace: Default
+SaveWorkspace: Default
+AlwaysSaveHistory: Default
+
+EnableCodeIndexing: Yes
+UseSpacesForTab: Yes
+NumSpacesForTab: 2
+Encoding: UTF-8
+
+RnwWeave: Sweave
+LaTeX: pdfLaTeX
diff --git a/install.R b/install.R
new file mode 100644
index 00000000..e69de29b
diff --git a/requirements.txt b/requirements.txt
index 47d15054..d05293f9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -33,6 +33,7 @@ json5==0.9.0
 jsonschema==3.2.0
 jupyter-client==6.0.0
 jupyter-core==4.6.3
+jupyter-rsession-proxy==1.1
 jupyter-telemetry==0.0.5
 jupyterhub==0.9.6
 jupyterlab==1.2.5
-- 
GitLab