-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththell-rstudio.dockerfile
executable file
·169 lines (141 loc) · 5.58 KB
/
thell-rstudio.dockerfile
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# RStudio Preview Base Setup
FROM thell:latest
# Minimal required to use all of the base features of RStudio Desktop.
# Uses the latest preview release, along with the most recent pandoc,
# mathjax, mathjax third party extensions, ccache for c++ work, and
# the testthat and microbenchmark packages.
# The Renviron is setup to use the new pandoc and mathjax.
USER root
# Apt repos setup
RUN . ddash; eval $pstime; \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9; \
# apt-add-repository "deb http://cran.rstudio.com/bin/linux/ubuntu wily/"
# r-cran- binaries
add-apt-repository -y "ppa:marutter/rrutter"; \
apt-add-repository -ys ppa:marutter/c2d4u
RUN . ddash; eval "$pstime"; apt-out apt-get update
# Apt installs
RUN . ddash; eval "$pstime"; \
# Without recommends...
daft\
# Feature support
default-jdk\
default-jre-headless\
firefox\
libreoffice-base\
libreoffice-java-common\
libreoffice-writer\
littler\
lmodern\
r-base\
r-base-dev\
r-recommended\
subversion\
texinfo\
texlive-base\
texlive-extra-utils\
texlive-fonts-extra\
texlive-fonts-recommended\
texlive-generic-recommended\
texlive-latex-base\
texlive-latex-extra\
texlive-latex-recommended
RUN . ddash; eval "$pstime"; \
# With recommends...
daft -r\
#apt-get -y install\
# Dev tools
ccache\
clang-format-3.7\
# R support
libcurl4-openssl-dev\
libssh2-1-dev\
libssl-dev\
libxml2-dev\
r-cran-base64enc\
r-cran-rcurl\
r-cran-rjsonio\
r-cran-rmarkdown; \
ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r; \
ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r; \
ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r; \
ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r
#
# For some reason builds starting getting errors that no namespace devtools existed...
#
# RUN \
# # R installs
# set -e; \
# export MAKEFLAGS='--jobs --silent'; \
# echo 'install.packages( c(\
# "devtools",\
# "docopt",\
# "microbenchmark",\
# "packrat",\
# "PKI",\
# "Rcpp",\
# "roxygen2",\
# "shiny"\
# ), repos=list( CRAN="https://cran.rstudio.com"), quiet=TRUE )' | r; \
# echo "devtools::install_github('hadley/testthat')" | r; \
# echo "devtools::install_github('hadley/devtools')" | r
#
# So split the previous chunk into multiple run commands and it works fines...
#
RUN echo 'install.packages("devtools", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("docopt", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("microbenchmark", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("packrat", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("PKI", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("Rcpp", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("roxygen2", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'install.packages("shiny", repos=list(CRAN="https://cran.rstudio.com"), quiet = TRUE)' | r
RUN echo 'devtools::install_github("hadley/testthat", quiet = TRUE)' | r
RUN echo 'devtools::install_github("hadley/devtools", quiet = TRUE)' | r
# Non-Apt App Downloads via Aria2
RUN . ddash && eval "$pstime" \
&& export DEBIAN_FRONTEND=noninteractive \
&& URL=https://www.rstudio.com/products/rstudio/download/preview/ \
&& EXPR='a[href$="amd64.deb"]:not([href*="server"]) attr{href}' \
&& curl -sS -L $URL | pup "${EXPR}" > input.txt \
&& printf "\tout=rstudio.deb\n" >> input.txt \
&& URL=https://api.github.com/repos/jgm/pandoc/releases \
&& EXPR='.[]|.assets[]|select(.name|endswith("-amd64.deb"))|.browser_download_url' \
&& curl -sS -L $URL | jq -r "${EXPR}" | head -n 1 >> input.txt \
&& printf "\tout=pandoc.deb\n" >> input.txt \
&& URL=https://api.github.com/repos/MathJax/MathJax/releases/latest \
&& curl -sS -L $URL | jq -r '.tarball_url' >> input.txt \
&& printf "\tout=mathjax.tar.gz\n" >> input.txt \
&& URL=https://github.com/mathjax/MathJax-third-party-extensions/archive/master.tar.gz \
&& printf "${URL}\n\tout=mathjax-contrib.tar.gz\n" >> input.txt \
&& cat input.txt \
&& aria2c -q -x 4 -i input.txt \
&& gdebi -n ./pandoc.deb \
&& gdebi -n ./rstudio.deb \
&& ln -s /usr/lib/rstudio/bin/rstudio /usr/local/bin/rstudio \
&& mkdir -p /usr/local/lib/mathjax/contrib \
&& tar -C /usr/local/lib/mathjax/ --strip-components 1 -zxf mathjax.tar.gz \
&& tar -C /usr/local/lib/mathjax/contrib --strip-components 1 -zxf mathjax-contrib.tar.gz \
&& rm input.txt rstudio.deb pandoc.deb mathjax.tar.gz mathjax-contrib.tar.gz \
&& echo 'update.packages(lib.loc = "/usr/lib/R/site-library", \
repo=list( CRAN="https://cran.rstudio.com"), ask=FALSE, quiet=TRUE )' | r
USER thell
RUN \
set -e;\
# Use Renviron to tell RStdudio to use local Pandoc and MathJax.
mkdir -p .config/R .local/lib/R/library; \
ln -s .config/R .R; \
echo "R_LIBS_USER=$HOME/.local/lib/R/library" > ~/.config/R/Renviron; \
echo "RSTUDIO_PANDOC=/usr/bin" >> ~/.config/R/Renviron; \
echo "MAKEFLAGS='--jobs'" >> ~/.config/R/Renviron; \
echo "RMARKDOWN_MATHJAX_PATH=/usr/local/lib/mathjax\n" >> ~/.config/R/Renviron; \
# Tell RStudio to use terminator
mkdir -p .config/rstudio-desktop/monitored/user-settings; \
ln -s .config/rstudio-desktop .rstudio-desktop; \
echo "vcsTerminalPath=\"/usr/bin/terminator\"" >> \
.rstudio-desktop/monitored/user-settings/user-settings
ENV \
R_ENVIRON_USER=~/.config/R/Renviron \
R_PROFILE_USER=~/.config/R/Rprofile
ENTRYPOINT ["/bin/bash", "-l", "-i", "-c"]
CMD ["rstudio"]