Skip to content

Instantly share code, notes, and snippets.

@slopp
Created April 26, 2019 20:18
Show Gist options
  • Select an option

  • Save slopp/f73918289eff315a60765da22ddbcc0b to your computer and use it in GitHub Desktop.

Select an option

Save slopp/f73918289eff315a60765da22ddbcc0b to your computer and use it in GitHub Desktop.
Dockerfile that creates a validated image based on a RStudio Package Manager repo
FROM ubuntu:bionic
ARG OS_IDENTIFIER=ubuntu-1804
ARG RSP_VERSION=1.2.1335-1
ARG RSP_PLATFORM=trusty
ARG R_VERSION=3.5.2
ARG REPO_BASE=http://demo.rstudiopm.com/validated
ARG REPO_PIN=1421
# Install the RSP bits for launcher
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdebi \
libcurl4-gnutls-dev \
libssl1.0.0 \
libssl-dev \
libuser \
libuser1-dev \
rrdtool \
wget
RUN wget https://s3.amazonaws.com/rstudio-ide-build/session/${RSP_PLATFORM}/rsp-session-${RSP_PLATFORM}-${RSP_VERSION}.tar.gz && \
mkdir -p /usr/lib/rstudio-server && \
tar -zxvf ./rsp-session-${RSP_PLATFORM}-${RSP_VERSION}.tar.gz -C /usr/lib/rstudio-server/ && \
mv /usr/lib/rstudio-server/rsp-session*/* /usr/lib/rstudio-server/ && \
rm -rf /usr/lib/rstudio-server/rsp-session* && \
rm -f ./rsp-session-${RSP_PLATFORM}-${RSP_VERSION}.tar.gz
EXPOSE 8787/tcp
# Install R pre-reqs
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
build-essential \
curl \
gfortran \
libatlas-base-dev \
libbz2-dev \
libcairo2 \
libcurl4-openssl-dev \
libicu-dev \
liblzma-dev \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpcre3-dev \
libtcl8.6 \
libtiff5 \
libtk8.6 \
libx11-6 \
libxt6 \
locales \
sudo \
tzdata \
wget \
zlib1g-dev
# Pull in R binary from RStudio CDN
RUN wget -O R-${R_VERSION}.tar.gz https://cdn.rstudio.com/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}.tar.gz && \
mkdir -p /opt/R && \
tar zx -C /opt/R -f ./R-${R_VERSION}.tar.gz && \
ln -s /opt/R/${R_VERSION}/bin/R /usr/bin/R && \
ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/bin/Rscript && \
ln -s /opt/R/${R_VERSION}/lib/R /usr/lib/R && \
rm R-${R_VERSION}.tar.gz
ENV LANG C.UTF-8
# Install package system reqs (from RSPM)
RUN apt-get update -qq && \
apt-get install -y \
libcurl4-openssl-dev \
libssl-dev
# Install validated packages from repo
# install.packages('httr', repos = 'https://demo.rstudio.pm.com/validated/1421')
RUN R -e "install.packages('httr', repos='${REPO_BASE}/${REPO_PIN}')"
# Set repo option
# options(repos = c(CRAN='https://demo.rstudiopm.com/validated/1421'))
RUN echo "options(repos =c(CRAN='${REPO_BASE}/${REPO_PIN}'))" > /opt/R/${R_VERSION}/lib/R/etc/Rprofile.site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment