This repository was archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
132 lines (127 loc) · 7.81 KB
/
Dockerfile
File metadata and controls
132 lines (127 loc) · 7.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
FROM zeyanlin/r-ver:latest
ARG RSTUDIO_VERSION
ENV PATH=/usr/lib/rstudio-server/bin:$PATH
## Download and install RStudio server & dependencies
## Attempts to get detect latest version, otherwise falls back to version given in $VER
## Symlink pandoc, pandoc-citeproc so they are available system-wide
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
file \
git \
libapparmor1 \
libcurl4-openssl-dev \
libedit2 \
libssl-dev \
lsb-release \
psmisc \
procps \
python-setuptools \
sudo \
wget \
&& wget -O libssl1.0.0.deb http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb \
&& dpkg -i libssl1.0.0.deb \
&& rm libssl1.0.0.deb \
&& RSTUDIO_LATEST=$(wget --no-check-certificate -qO- https://s3.amazonaws.com/rstudio-server/current.ver) \
&& [ -z "$RSTUDIO_VERSION" ] && RSTUDIO_VERSION=$RSTUDIO_LATEST || true \
&& wget -q http://download2.rstudio.org/rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
&& dpkg -i rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
&& rm rstudio-server-*-amd64.deb \
## Symlink pandoc & standard pandoc templates for use system-wide
&& ln -s /usr/lib/rstudio-server/bin/pandoc/pandoc /usr/local/bin \
&& ln -s /usr/lib/rstudio-server/bin/pandoc/pandoc-citeproc /usr/local/bin \
&& git clone https://github.com/jgm/pandoc-templates \
&& mkdir -p /opt/pandoc/templates \
&& cp -r pandoc-templates*/* /opt/pandoc/templates && rm -rf pandoc-templates* \
&& mkdir /root/.pandoc && ln -s /opt/pandoc/templates /root/.pandoc/templates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
## RStudio wants an /etc/R, will populate from $R_HOME/etc
&& mkdir -p /etc/R \
## Write config files in $R_HOME/etc
&& echo '\n\
\n# Configure httr to perform out-of-band authentication if HTTR_LOCALHOST \
\n# is not set since a redirect to localhost may not work depending upon \
\n# where this Docker container is running. \
\nif(is.na(Sys.getenv("HTTR_LOCALHOST", unset=NA))) { \
\n options(httr_oob_default = TRUE) \
\n}' >> /usr/local/lib/R/etc/Rprofile.site \
&& echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron \
## Need to configure non-root user for RStudio
&& useradd rstudio \
&& echo "rstudio:rstudio" | chpasswd \
&& mkdir /home/rstudio \
&& chown rstudio:rstudio /home/rstudio \
&& addgroup rstudio staff \
## Prevent rstudio from deciding to use /usr/bin/R if a user apt-get installs a package
&& echo 'rsession-which-r=/usr/local/bin/R' >> /etc/rstudio/rserver.conf \
## use more robust file locking to avoid errors when using shared volumes:
&& echo 'lock-type=advisory' >> /etc/rstudio/file-locks \
## configure git not to request password each time
&& git config --system credential.helper 'cache --timeout=3600' \
&& git config --system push.default simple \
## Set up S6 init system
&& wget -P /tmp/ https://github.com/just-containers/s6-overlay/releases/download/v1.11.0.1/s6-overlay-amd64.tar.gz \
&& tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \
&& mkdir -p /etc/services.d/rstudio \
&& echo '#!/usr/bin/with-contenv bash \
\n exec /usr/lib/rstudio-server/bin/rserver --server-daemonize 0' \
> /etc/services.d/rstudio/run \
&& echo '#!/bin/bash \
\n rstudio-server stop' \
> /etc/services.d/rstudio/finish \
&& mkdir -p /home/rstudio/.rstudio/monitored/user-settings \
&& echo 'alwaysSaveHistory="0" \
\nloadRData="0" \
\nsaveAction="0"' \
> /home/rstudio/.rstudio/monitored/user-settings/user-settings \
&& chown -R rstudio:rstudio /home/rstudio/.rstudio \
# Install some packages
# && R -e "install.packages('broom', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('caTools', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('coefplot', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('colorspace', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('data.table', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('Deducer', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
&& R -e "install.packages('devtools', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('digest', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('dplyr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('functional', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('GGally', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
&& R -e "install.packages('ggplot2', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('knitr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('labeling', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('lattice', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('lubridate', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('magrittr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('mapdata', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('maps', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('maptools', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('methods', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('pixmap', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('plyr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('png', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('quickcheck', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('Rcmdr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('RColorBrewer', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('Rcpp', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('reshape2', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('rgeos', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('RJDBC', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('RJSONIO', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('rvest', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('scales', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('shiny', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('sp', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('stringr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('testthat', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('tidyr', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('XLConnect', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
# && R -e "install.packages('zoo', dependencies=TRUE, repos='https://cran.rstudio.com/')" \
&& rm -rf /tmp/*
COPY userconf.sh /etc/cont-init.d/userconf
## running with "-e ADD=shiny" adds shiny server
COPY add_shiny.sh /etc/cont-init.d/add
EXPOSE 8787
## automatically link a shared volume for allen users
VOLUME /home/rstudio/allen
CMD ["/init"]