forked from kapsner/docker_images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdsc_headless_j.dockerfile
386 lines (343 loc) · 11.6 KB
/
rdsc_headless_j.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
FROM joundso/rdsc_base_j:latest
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/joundso/r_datascience"
ENV DEBIAN_FRONTEND=noninteractive
## build ARGs
ARG NCPUS=${NCPUS:--1}
# USER ${RSESSION_USER}
RUN install2.r --error --skipinstalled -n $NCPUS \
abind \
arsenal \
autonewsmd \
bib2df \
bigmemory \
billboarder \
bookdown \
class \
cleaR \
cluster \
ClusterR \
config \
covr \
cowplot \
credentials \
crosstable \
curl \
data.table \
daterangepicker \
DBI \
desc \
DescTools \
DescrTab2 \
devtools \
distill \
DIZtools \
doParallel \
dotenv \
dplyr \
DT \
dtplyr \
dunn.test \
eeptools \
effects \
emmeans \
fhircrackr \
finalfit \
foreach \
formatR \
# DQAstats:
future \
# DQAstats:
future.apply \
ggfortify \
ggplot2 \
ggpubr \
ggside \
ggstatsplot \
gtsummary \
gplots \
highcharter \
Hmisc \
httr \
influxdbr \
jpeg \
jsonlite \
kableExtra \
knitr \
languageserver \
## For xaringan:
leaflet \
lintr \
logger \
lubridate \
markdown \
Matrix \
metathis \
## `mice` for imputation of missing values:
mice \
microbenchmark \
## `missForest` for imputation of missing values:
missForest \
mlbench \
## Mixed model (for) repeated measurements:
mmrm \
naivebayes \
odbc \
openssl \
openxlsx \
pagedown \
parallel \
parsedate \
pheatmap \
plotly \
plyr \
psych \
quarto \
R.utils \
R6 \
rapportools \
# rattle \
rcmdcheck \
RCurl \
reactable \
readr \
redcapAPI \
REDCapR \
RefManageR \
remotes \
report \
## Reproducible Examples:
reprex \
reshape2 \
# reticulate \
rJava \
RJDBC \
RJSONIO \
rlang \
rmarkdown \
Rmisc \
roxygen2 \
RPostgres \
RPresto \
RSQLite \
rstudioapi \
see \
shiny \
shinyalert \
shinydashboard \
shinyFiles \
shinyjs \
shinytest \
shinythemes \
shinyWidgets \
sjPlot \
sjtable2df \
skimr \
sqldf \
styler \
summarytools \
sunburstR \
survival \
survminer \
testthat \
tidyr \
tidyverse \
timeDate \
tinytex \
tiff \
treemap \
urltools \
usethis \
utf8 \
## `VIM` for visualizing missing values:
VIM \
## `webshot` only for phantomjs:
# webshot \
wesanderson \
wordcloud \
wordcloud2 \
xaringan \
xfun \
xgboost \
XML \
xml2 \
yaml \
zip \
&& rm -rf /tmp/downloaded_packages \
&& rm -rf /var/lib/apt/lists/*
USER ${RSESSION_USER}
# install required LaTeX-Packages
RUN R -q -e "tinytex::install_tinytex()"
ENV PATH="/home/${RSESSION_USER}/bin:/home/${RSESSION_USER}/.TinyTeX/bin/x86_64-linux:${PATH}"
ARG tiny="'amsfonts', \
'amsmath', \
'atveryend', \
'babel', \
'babel-german', \
'caption', \
'colortbl', \
'dehyph-exptl', \
'ec', \
'environ', \
'epstopdf-pkg', \
'float', \
'geometry', \
'graphics', \
'graphics-def', \
'hycolor', \
'hyperref', \
'hyphen-german', \
'iftex', \
'koma-script', \
'latex-graphics-dev', \
'latexconfig', \
'lm', \
'makecell', \
'multirow', \
'oberdiek', \
'pdfcrop', \
'pdflscape', \
'tabu', \
'tex-gyre-math', \
'texlive-scripts', \
'threeparttable', \
'threeparttablex', \
'titling', \
'tools', \
'trimspaces', \
'ulem', \
'varwidth', \
'wrapfig', \
'ulem', \
'url', \
'xcolor'"
RUN R -q -e "tinytex::tlmgr_conf(); \
tinytex::tlmgr_install(pkgs = c(${tiny})); \
tinytex::tlmgr_update()"
USER root
RUN chown -R ${RSESSION_USER}:${RSESSION_USER} /home/${RSESSION_USER}/.TinyTeX && \
chmod -R g+w /home/${RSESSION_USER}/.TinyTeX && \
chown -R ${RSESSION_USER}:${RSESSION_USER} /usr/local/lib/R/site-library
# && \ chmod -R g+wx /home/${RSESSION_USER}/bin
# safety-check at the end:
# 1) look if everything is installed correctely (if not, you might add system-dependencies in the base_image)
# 2) update all packages to the newest version
# 3) start rstudio-server
# ARG allpackages="\"$a\" \"$b\" \"$c\" \"$d\" \"$e\" \"$f\" \"$g\" \"$h\" \
# \"$i\" \"$j\" \"$k\" \"$l\" \"$m\" \"$n\" \"$o\" \"$p\" \"$q\" \"$r\" \
# \"$s\" \"$t\" \"$u\" \"$v\" \"$w\" \"$x\" \"$y\" \"$z\""
# RUN export packages_format="$(echo $(echo ${allpackages} | sed -e 's/ /\"\, \"/g') | sed -e 's/\"\"/\"/g')" && \
# R -q -e "vec <- setdiff(c($packages_format), unname(installed.packages()[,\"Package\"])); print(vec); vec2 <- intersect(c(vec), unname(available.packages()[,\"Package\"])); print(vec2); install.packages(pkgs = vec2)"
# update all installed packages
RUN R -q -e "vec <- unname(installed.packages()[,\"Package\"]); remotes::update_packages(packages = vec, build_manual = FALSE, quiet = TRUE, upgrade = \"always\")" && \
rm -rf /tmp/*
USER ${RSESSION_USER}
ARG GITHUB_PAT
# configure the other r packages
# install phantomjs
# RUN R -q -e "webshot::install_phantomjs(); \
# ## Install shinytest dependencies (= phantomjs):
# shinytest::installDependencies()"
# RUN R -q -e "credentials::set_github_pat('${GITHUB_PAT}'); \
# usethis::git_sitrep()"
# Install the stuff, where I participate:
# RUN R -q -e "devtools::install_git(url = 'https://gitlab.miracum.org/miracum/dqa/dqastats.git', ref = 'master')"
# RUN R -q -e "devtools::install_git(url = 'https://gitlab.miracum.org/miracum/dqa/dqagui.git', ref = 'master')"
RUN R -q -e "remotes::install_git(url = 'https://gitlab.miracum.org/miracum/dqa/miRacumdqa.git', ref = 'master'); \
remotes::install_github(repo = 'miracum/misc-dizutils', ref = 'development'); \
# remotes::install_github(repo = 'miracum/misc-diztools', ref = 'dev'); \
# remotes::install_github(repo = 'joundso/mainzelliste-connector', ref = 'development'); \
# remotes::install_github(repo = 'joundso/rkafka', ref = 'development'); \
# remotes::install_github(repo = 'joundso/gpas_connector', ref = 'development'); \
# remotes::install_github(repo = 'joundso/requirements', ref = 'development'); \
# remotes::install_github(repo = 'joundso/usRbility', ref = 'dev'); \
remotes::install_github(repo = 'joundso/cleaR', ref = 'dev'); \
## Other stuff:
remotes::install_github(repo = 'blmoore/rjsonpath'); \
## Formatting comments and RMarkdown tables:
remotes::install_github(repo = 'mwip/beautifyR'); \
## Addin to easy insert roxygen formatting options:
remotes::install_github('matt-dray/snorkel'); \
## Explore data and create ggplots:
remotes::install_github('dreamRs/esquisse'); \
## Data Analytics:
options(repos = c(RSM = 'https://radiant-rstats.github.io/minicran', CRAN = 'https://cloud.r-project.org')); \
install.packages('radiant'); \
# remotes::install_github('radiant-rstats/radiant.update', upgrade = 'never'); \
# radiant.update::radiant.update(); \
## Presentations with xaringan:
# remotes::install_github('yihui/xaringan'); \
# remotes::install_github('jhelvy/xaringanBuilder'); \
# devtools::install_github('gadenbuie/xaringanExtra'); \
## Rattle for models:
## (since `RGtk2` is no longer on CRAN, we use the last version from the archive
## https://cran.r-project.org/src/contrib/Archive/RGtk2/
## https://cran.r-project.org/package=RGtk2
## here:)
# install.packages('https://cran.r-project.org/src/contrib/Archive/RGtk2/RGtk2_2.20.36.3.tar.gz', repos=NULL); \
# install.packages('rattle', repos='https://rattle.togaware.com', type='source'); \
# Enable installation with pre-built Rust library binary, or enable Rust caching
Sys.setenv(NOT_CRAN ='true'); \
install.packages('polars', repos = 'https://rpolars.r-universe.dev'); \
## Stuff to don't repeat myself:
remotes::install_github('kapsner/kdry')"
USER root
## Change rights to access packages as user 'user':
# RUN chown -R ${RSESSION_USER}:${RSESSION_USER} /usr/local/lib/R/site-library
RUN yes | pip install --no-cache-dir \
# git+https://github.com/miracum/dqa-mdr-connector.git && \
git+https://github.com/miracum/dqa-mdr-connector@development && \
# clear caches
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /root/.cache/pip/* && \
rm -rf /home/${USER_UID}/.cache/pip/* && \
apt-get clean && apt-get autoclean && apt-get autoremove -y
# install sudo here, required for rstudio:
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /home/${RSESSION_USER}/.cache/pip/* && \
apt-get clean all && \
apt-get autoclean && \
apt-get autoremove -y && \
# set ubuntu password here (password required for rstudio login)
echo ${USER}:password | chpasswd && \
echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} && \
chmod 0440 /etc/sudoers.d/${USER}
# make deployed shiny app accessible via port 3838
RUN echo "options(shiny.port = 3838)" >> /home/${RSESSION_USER}/.Rprofile && \
echo "options(shiny.host = '0.0.0.0')" >> /home/${RSESSION_USER}/.Rprofile && \
echo "options(shiny.launch.browser = FALSE)" >> /home/${RSESSION_USER}/.Rprofile && \
echo "options(shiny.error = browser)" >> /home/${RSESSION_USER}/.Rprofile && \
echo "options(shiny.fullstacktrace = TRUE)" >> /home/${RSESSION_USER}/.Rprofile && \
# https://github.com/Ikuyadeu/vscode-R#r-session-watcher-experimental
echo "source(file.path(Sys.getenv(if (.Platform\$OS.type == 'windows') 'USERPROFILE' else 'HOME'), '.vscode-R', 'init.R'))" >> /home/${RSESSION_USER}/.Rprofile && \
chown -R ${RSESSION_USER}:${RSESSION_USER} /home/${RSESSION_USER}/.Rprofile
# add PATH to a bash_profile script (workaround so that path is available in rstudio's terminal)
# https://support.rstudio.com/hc/en-us/articles/115010737148-Using-the-RStudio-Terminal#env
# https://docs.rstudio.com/ide/server-pro/1.2.1293-1/r-sessions.html
RUN echo "export PATH=${PATH}" >> /home/${RSESSION_USER}/.bash_profile && chmod +x /home/${RSESSION_USER}/.bash_profile
# set PATH for all users
RUN echo "PATH=${PATH}" >> /etc/R/Renviron && \
echo "PATH=${PATH}" >> /etc/environment
# add radian profile
ADD config/.radian_profile /home/${RSESSION_USER}/.radian_profile
RUN chown -R ${RSESSION_USER}:${RSESSION_USER} /home/${RSESSION_USER}/.radian_profile
# fix permissions in home folder
# RUN chown -R ${RSESSION_USER}:${RSESSION_USER} /home/${RSESSION_USER}/.local
# Add JDBC drivers:
RUN mkdir -p /opt/libs && \
curl -SL https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/19.8.0.0/ojdbc8-19.8.0.0.jar -o /opt/libs/ojdbc8.jar && \
curl -SL https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/19.8.0.0/ojdbc10-19.8.0.0.jar -o /opt/libs/ojdbc10.jar && \
chown -R ${RSESSION_USER}:${RSESSION_USER} /opt/libs/ && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /root/.cache/pip/* && \
rm -rf /home/${USER}/.cache/pip/* && \
apt-get clean all && \
apt-get autoclean && \
apt-get autoremove -y
WORKDIR /home/${RSESSION_USER}