forked from granek/singularity-rstudio-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRStudio403MKL.def
More file actions
199 lines (167 loc) · 6.13 KB
/
RStudio403MKL.def
File metadata and controls
199 lines (167 loc) · 6.13 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
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
BootStrap: docker
From: ubuntu:20.04
%labels
Maintainer Dror Shvadron
R_Version 4.0.3
RStudio_Version 1.3.1093
MKL_Version intel-mkl-64bit-2020.0-088
Image_Name singularity-rstudio-mkl
Image_Version singularity-rstudio-mkl-01
%help
This will run RStudio Server with tidyverse and support for knitting
%runscript
exec port_and_password "${@}"
%apprun R
exec R "${@}"
%apprun Rscript
exec Rscript "${@}"
%apprun rserver
exec rserver "${@}"
%apprun rstudio
exec rserver "${@}"
%apprun default
exec "${@}"
%apprun pp
exec port_and_password "${@}"
%environment
export PATH=/usr/lib/rstudio-server/bin:${PATH}:/usr/lib/rstudio-server/bin/pandoc
export SHELL=/bin/bash
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export MKL_THREADING_LAYER=GNU
%setup
install -Dv \
rstudio_auth_1_3.sh \
${SINGULARITY_ROOTFS}/usr/lib/rstudio-server/bin/rstudio_auth
install -Dv \
ldap_auth.py \
${SINGULARITY_ROOTFS}/usr/lib/rstudio-server/bin/ldap_auth
install -Dv \
port_and_password_1_3.sh \
${SINGULARITY_ROOTFS}/usr/lib/rstudio-server/bin/port_and_password
%post
# Software versions
export R_VERSION=4.0.3
export RSTUDIO_VERSION=1.3.1093
export MKL_VERSION=intel-mkl-64bit-2020.0-088
export DEBIAN_FRONTEND=noninteractive
# Get dependencies
apt-get update
apt-get install -y --no-install-recommends \
apt-utils \
gnupg2 \
locales \
ca-certificates \
wget \
gdebi-core \
libssl1.1 \
libssl-dev \
dpkg-sig \
python3-ldap3
# Configure default locale
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen en_US.utf8
/usr/sbin/update-locale LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Install MKL (following http://dirk.eddelbuettel.com/blog/2018/04/15/#018_mkl_for_debian_ubuntu)
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
apt-get update
apt-get install -y ${MKL_VERSION}
# bug (?) fix (see https://github.com/eddelbuettel/mkl4deb)
echo "MKL_THREADING_LAYER=GNU" >> /etc/environment
mkdir -p /etc/rstudio
echo "MKL_THREADING_LAYER=GNU" >> /etc/rstudio/rsession-profile
echo "MKL_THREADING_LAYER=GNU" >> /etc/profile
# There is an additional setting that is required (see https://cran.rstudio.com/doc/manuals/r-patched/R-admin.html#MKL)
# echo "MKL_INTERFACE_LAYER=GNU,LP64" >> /etc/environment
## update alternatives
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so \
libblas.so-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so.3 \
libblas.so.3-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so \
liblapack.so-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so.3 \
liblapack.so.3-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
echo "/opt/intel/lib/intel64" > /etc/ld.so.conf.d/mkl.conf
echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf
ldconfig
# Install R
echo "deb http://cran.r-project.org/bin/linux/ubuntu focal-cran40/" > /etc/apt/sources.list.d/r.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get install -y --no-install-recommends \
r-base=${R_VERSION}* \
r-base-core=${R_VERSION}* \
r-base-dev=${R_VERSION}* \
r-recommended=${R_VERSION}* \
r-base-html=${R_VERSION}* \
r-doc-html=${R_VERSION}* \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libcairo2-dev \
libxt-dev \
libglpk-dev \
libgmp3-dev \
libharfbuzz-dev \
libfribidi-dev
# Add a default CRAN mirror. Using CRAN binary timestamp 2020-12-15
echo "options(repos = c(CRAN = 'https://packagemanager.rstudio.com/all/__linux__/focal/287740'), download.file.method = 'libcurl')" >> /usr/lib/R/etc/Rprofile.site
# Add a directory for host R libraries
mkdir -p /library
echo "R_LIBS_SITE=/library:\${R_LIBS_SITE}" >> /usr/lib/R/etc/Renviron.site
# Clean up
# rm -rf /var/lib/apt/lists/*
# Install RStudio Server
# not working
# gpg2 --keyserver keys.gnupg.net --recv-keys 3F32EE77E331692F
# alternative?
gpg2 --keyserver hkps://peegeepee.com --recv-keys 3F32EE77E331692F
wget --no-verbose \
-O rstudio-server.deb \
"https://download2.rstudio.org/server/bionic/amd64/rstudio-server-${RSTUDIO_VERSION}-amd64.deb" && \
dpkg-sig --verify rstudio-server.deb && \
gdebi -n rstudio-server.deb && \
rm rstudio-server.deb
# Install tidyverse, here, and packages necessary for knitting to HTML
# Using CRAN binary timestamp 2020-12-15
Rscript -e "install.packages(pkgs = c('tidyverse','here','caTools','rprojroot','Rcpp', 'base64enc', 'digest', 'evaluate', 'glue', 'highr', 'htmltools', 'jsonlite', 'knitr', 'magrittr', 'markdown', 'mime', 'rmarkdown', 'rprojroot', 'stringi', 'stringr', 'tinytex', 'xfun', 'yaml'), \
repos='https://packagemanager.rstudio.com/all/__linux__/focal/287740', \
dependencies=TRUE, \
clean = TRUE)"
# Install additional packages
Rscript -e "install.packages(pkgs = c('drake', 'igraph', 'fixest','fst', 'lubridate', 'ggthemes'), \
repos='https://packagemanager.rstudio.com/all/__linux__/focal/287740', \
dependencies=TRUE, \
clean = TRUE)"
# Install extra stuff
apt-get install -y --no-install-recommends \
bsdmainutils \
iproute2 \
libxml2-dev \
curl \
wget \
bzip2 \
ca-certificates \
sudo \
locales \
emacs \
less \
make \
git \
ssh \
htop \
jq \
vim
# Clean up
apt-get clean && rm -rf /var/lib/apt/lists/*
# Make Mountpoints
mkdir -p /data
mkdir -p /workspace