-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
151 lines (126 loc) · 5.09 KB
/
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
# To build from the parent directory:
# docker build -t wch1/r-devel r-devel
#
# To run:
# docker run --rm -ti --name rd wch1/r-devel
# Use a very recent version of Ubuntu to get the latest GCC, which we need for
# some of options used for ASAN builds.
FROM ubuntu:20.04
MAINTAINER Winston Chang "[email protected]"
# =====================================================================
# R
# =====================================================================
# Don't print "debconf: unable to initialize frontend: Dialog" messages
ARG DEBIAN_FRONTEND=noninteractive
# Need this to add R repo
RUN apt-get update && apt-get install -y software-properties-common wget
# LLVM-12
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main"
# Add R apt repository
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository "deb http://cran.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
# Install basic stuff, R, and other packages that are useful for compiling R
# and R packages.
RUN apt-get update && apt-get install -y \
sudo \
locales \
git \
vim \
less \
wget \
r-base \
r-base-dev \
r-recommended \
automake \
libtool \
fonts-texgyre \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-openssl-dev \
libcairo2-dev \
libpango1.0-dev \
libxt-dev \
libssl-dev \
libgit2-dev \
libxml2-dev \
texinfo \
rsync \
default-jdk \
bison \
libtiff5-dev \
tcl8.6-dev \
tk8.6-dev \
xfonts-base \
xvfb \
gcc-10 \
g++-10 \
gdb \
valgrind \
clang-12 \
lldb-12 \
devscripts
RUN locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 800 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 800 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-12 \
--slave /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-12
RUN echo 'options(\n\
repos = c(CRAN = "https://cloud.r-project.org/"),\n\
download.file.method = "libcurl",\n\
# Detect number of physical cores\n\
Ncpus = parallel::detectCores(logical=FALSE)\n\
)' >> /etc/R/Rprofile.site
# Install TinyTeX (subset of TeXLive)
# From FAQ 5 and 6 here: https://yihui.name/tinytex/faq/
# Also install ae, parskip, and listings packages to build R vignettes
RUN wget -qO- \
"https://yihui.org/gh/tinytex/tools/install-unx.sh" | \
sh -s - --admin --no-path \
&& ~/.TinyTeX/bin/*/tlmgr path add \
&& tlmgr install metafont mfware inconsolata tex ae parskip listings xcolor \
epstopdf-pkg pdftexcmds kvoptions texlive-scripts grfext \
&& tlmgr path add \
&& Rscript -e "install.packages('tinytex'); tinytex::r_texmf()"
# =====================================================================
# Install various versions of R-devel
# =====================================================================
# Environment variables from http://www.stats.ox.ac.uk/pub/bdr/memtests/README.txt
ENV ASAN_OPTIONS 'detect_leaks=0:detect_odr_violation=0'
ENV UBSAN_OPTIONS 'print_stacktrace=1'
ENV RJAVA_JVM_STACK_WORKAROUND 0
ENV RGL_USE_NULL true
ENV R_DONT_USE_TK true
# Clone R-devel and download recommended packages
RUN cd /tmp \
&& git clone --depth 1 https://github.com/wch/r-source.git \
&& r-source/tools/rsync-recommended
COPY buildR.sh /tmp
# RD: Install normal R-devel.
#
# This R installation is slightly different from the ones that follow. It is
# configured with the recommended packages, and has those packages installed
# packages to library/ (not site-library/). These packages will be shared with
# the other RD* installations that follow. For all the RD* installations
# (including this one), all packages installed after buildR.sh runs will be
# installed to each installation's site-library/.
#
# I've set it up this way because the "recommended" packages take a long time
# to compile and in most cases aren't involved in debugging the low-level
# problems that this Dockerfile is for, so it's OK to compile them once and
# share them. Other packages, like those installed by the user and Rcpp
# (*especially* Rcpp), are often of interest -- they are installed for each
# RD* installation, and code is compiled with whatever compiler settings are
# used for each RD* installation.
RUN /tmp/buildR.sh
# Install some commonly-used packages to a location used by all the RD*
# installations. These packages do not have compiled code and do not depend on
# packages that have compiled code.
RUN RD -q -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/", "/usr/local/RD/lib/R/library")'
RUN RD -q -e 'pak::pkg_install(c("BH", "R6", "magrittr"), "/usr/local/RD/lib/R/library")'
# Finally, install some common packages specific to this build of R.
RUN RD -q -e 'pak::pkg_install(c("devtools", "Rcpp", "roxygen2", "testthat", "memoise", "rmarkdown"))'