Skip to content

chore: updated RStudio Dockerfile #930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2022
Merged
Changes from all commits
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
35 changes: 12 additions & 23 deletions workspaces/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,47 +319,36 @@ Coder supports [RStudio](rstudio.com). To create a workspace that lets you use
RStudio:

1. Create a [custom image](../images/writing.md) with RStudio installed,
`rserver` and `pgrep` in `PATH`, and RStudio configured to run on the default
port (`8787`).
`rserver` in `PATH`.

To do this, you can refer to the sample Dockerfile below, which installs
RStudio Server Open Source and creates a Unix user to log in with username
`coder` and password `rstudio`.
RStudio Server Open Source to log in with username `coder` and password
`rstudio`.

> This Dockerfile approach works now with latest versions of RStudio
> including 2022-2-1.

```Dockerfile
FROM ubuntu:20.04
FROM codercom/enterprise-base:ubuntu

USER root

# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes \
bash \
sudo \
git \
ssh \
locales \
wget \
r-base \
gdebi-core

# Install RStudio
RUN wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.4.1717-amd64.deb && \
gdebi --non-interactive rstudio-server-1.4.1717-amd64.deb

# Create coder user
RUN useradd coder \
--create-home \
--shell=/bin/bash \
--uid=1000 \
--user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd
RUN wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.1-461-amd64.deb && \
gdebi --non-interactive rstudio-server-2022.02.1-461-amd64.deb

# Ensure rstudio files can be written to by the coder user.
RUN chown -R coder:coder /var/lib/rstudio-server
RUN echo "server-pid-file=/tmp/rstudio-server.pid" >> /etc/rstudio/rserver.conf
RUN echo "server-data-dir=/tmp/rstudio" >> /etc/rstudio/rserver.conf
RUN echo "www-frame-origin=same" >> /etc/rstudio/rserver.conf
RUN echo "server-user=coder" >> /etc/rstudio/rserver.conf

# Remove the following line if you do not run Coder on https
RUN echo "server-add-header=X-Forwarded-Proto: https" >> /etc/rstudio/rserver.conf
Expand All @@ -384,8 +373,8 @@ RStudio:

![Applications with RStudio launcher](../assets/workspaces/rstudio.png)

Sign in using the Unix user (whose username and password you defined in your
image).
Coder auto-signs in using the Unix user (whose username and password you
defined in your custom image above).

> RStudio may take a few additional seconds to start launch after the
> workspace is built.
Expand Down