-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
319 lines (295 loc) · 7.92 KB
/
Copy pathDockerfile
File metadata and controls
319 lines (295 loc) · 7.92 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
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
# Pull base image.
FROM ubuntu:bionic-20180125@sha256:d6f6cc62b6bed64387d84ca227b76b9cc45049b0d0aefee0deec21ed19a300bf
COPY . /opt/conduit/
SHELL ["/bin/bash", "-c"]
# Define default working directory.
WORKDIR /opt/conduit
# Prevent interactive time zone config.
# adapted from https://askubuntu.com/a/1013396
ENV DEBIAN_FRONTEND=noninteractive
# adapted from https://users.open-mpi.narkive.com/tEPxZF0B/ompi-users-how-to-get-rid-of-openmpi-warning-unable-to-find-any-relevant-network-interfaces
# see also https://github.com/open-mpi/ompi-www/issues/161#issue-390004007
RUN \
mkdir -p "/root/.openmpi" \
&& \
mkdir -p "/home/user/.openmpi" \
&& \
echo "btl_base_warn_component_unused = 0" >> /etc/openmpi-mca-params.conf \
&& \
echo "btl_base_warn_component_unused = 0" >> /root/.openmpi/mca-params.conf \
&& \
echo "btl_base_warn_component_unused = 0" >> /home/user/.openmpi/mca-params.conf \
&& \
echo "configured system-wide openmpi mca parameters"
RUN \
echo 'Acquire::http::Timeout "60";' >> "/etc/apt/apt.conf.d/99timeout" \
&& \
echo 'Acquire::ftp::Timeout "60";' >> "/etc/apt/apt.conf.d/99timeout" \
&& \
echo 'Acquire::Retries "100";' >> "/etc/apt/apt.conf.d/99timeout" \
&& \
echo "buffed apt-get resiliency"
RUN \
find /etc/apt -type f -name '*.list' -exec sed -i 's/\(^deb.*-backports.*\)/#\1/; s/\(^deb.*-updates.*\)/#\1/; s/\(^deb.*-proposed.*\)/#\1/; s/\(^deb.*-security.*\)/#\1/' {} + \
&& \
rm -rf /var/lib/apt/lists/* \
&& \
echo "removed -backports, -updates, -proposed, -security repositories"
# adapted in part form https://www.cloudsavvyit.com/13461/how-to-run-puppeteer-and-headless-chrome-in-a-docker-container/
RUN \
apt-get update -qq \
&& \
apt-get install -y --allow-downgrades --no-install-recommends \
build-essential \
ca-certificates \
cmake \
curl \
doxygen \
emacs \
fonts-liberation \
gconf-service \
gdb \
gpg-agent \
gzip \
hdf5-helpers \
hdf5-tools \
htop \
libappindicator1 \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libcurl4 \
libcurl4-openssl-dev \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm-dev \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libicu-dev \
libjpeg-dev \
libhdf5-100 \
libhdf5-cpp-100 \
libhdf5-dev \
libhdf5-doc \
libhdf5-mpi-dev \
libhdf5-mpich-100 \
libhdf5-mpich-dev \
libhdf5-openmpi-100 \
libhdf5-openmpi-dev \
libhdf5-serial-dev \
libmpich-dev \
libmpich12 \
libnspr4 \
libnss3 \
libopenmpi-dev \
libopenmpi2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpng-dev \
libpthread-stubs0-dev \
libstdc++-7-dev \
libstdc++6=8-20180414-1ubuntu2 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
locales \
lsb-release \
man \
mpich \
multitail \
nano \
ninja-build \
nodejs \
npm \
openmpi-bin \
openmpi-common \
openmpi-doc \
openssh-server \
python-dev \
python-h5py \
python-pip \
python-setuptools \
python-sphinx \
python-virtualenv \
python-wheel \
python3-dev \
python3-h5py \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-virtualenv \
python3-wheel \
rename \
rsync \
slurm-client \
software-properties-common \
tar \
unzip \
vim \
wget \
xdg-utils \
&& \
add-apt-repository ppa:git-core/ppa -y \
&& \
apt-get update -qq \
&& \
apt-get install -y --no-install-recommends git \
&& \
apt-get clean \
&& \
rm -rf /var/lib/apt/lists/* \
&& \
echo "installed fundamentals"
# adapted in part from https://askubuntu.com/a/916451
RUN \
apt-get update -qq \
&& \
rm /etc/apt/apt.conf.d/docker-gzip-indexes \
&& \
apt-get purge apt-show-versions \
&& \
rm /var/lib/apt/lists/*lz4 \
&& \
apt-get -o Acquire::GzipIndexes=false update \
&& \
add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& \
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& \
apt-add-repository "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" \
&& \
add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& \
apt-get update -qq \
&& \
apt-get clean \
&& \
rm -rf /var/lib/apt/lists/* \
&& \
echo "configured packaging system"
RUN \
apt-get update -qq \
&& \
apt-get install -qq \
libclang-7-dev=1:7.1.0~svn353565-1~exp1~20190408084827.60 \
llvm-7=1:7.1.0~svn353565-1~exp1~20190408084827.60 \
llvm-7-dev=1:7.1.0~svn353565-1~exp1~20190408084827.60 \
clang-7=1:7.1.0~svn353565-1~exp1~20190408084827.60 \
g++-9=9.4.0-1ubuntu1~18.04 \
&& \
apt-get clean \
&& \
rm -rf /var/lib/apt/lists/* \
&& \
echo "installed llvm-7 dependencies"
# magic from https://github.com/puppeteer/puppeteer/issues/3451#issuecomment-523961368
RUN echo 'kernel.unprivileged_userns_clone=1' > /etc/sysctl.d/userns.conf
RUN \
python3 -m pip install --timeout 60 --retries 100 --upgrade pip==21.3.1 \
&& \
python3 -m pip install --timeout 60 --retries 100 --ignore-installed -r /opt/conduit/third-party/requirements.txt \
&& \
python3 -m pip install --timeout 60 --retries 100 --ignore-installed -r /opt/conduit/docs/requirements.txt \
&& \
echo "installed Python packages"
RUN \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 \
&& \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-7 90 \
&& \
update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-7 90 \
&& \
update-alternatives --install /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-7 90 \
&& \
update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-7 90 \
&& \
npm install -g n@6.7.0 \
&& \
n 12.18.2 \
&& \
export python="/usr/bin/python" \
&& \
npm install source-map@0.7.3 \
&& \
echo "finalized dependency versions"
RUN \
npm install -g jsonlint@1.6.3 \
&& \
echo "installed npm dependencies"
RUN \
cd third-party \
&& \
./install_dependencies.sh \
&& \
echo "installed third party dependencies"
# set up locale
# adapted from https://stackoverflow.com/a/55077451
RUN \
locale-gen en_US.UTF-8 \
&& \
echo "generated en_US.UTF-8 locale"
# Set enviroment variables
# Use mimalloc override within the container.
ENV LD_PRELOAD=/usr/local/lib/mimalloc-1.6/libmimalloc.so
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN \
git remote set-url origin https://github.com/mmore500/conduit.git \
&& \
echo "switched to https origin remote url"
# Perform any further action as an unprivileged user.
# adapted from https://stackoverflow.com/a/27703359
# and https://superuser.com/a/235398
RUN \
useradd --create-home --shell /bin/bash user \
&& \
groupadd group \
&& \
gpasswd -a user group \
&& \
chgrp --recursive user /opt \
&& \
chmod --recursive g+rwx /opt \
&& \
chmod --recursive g+rwx /home/user \
&& \
chown -R user /home/user/ \
&& \
echo "user added and granted permissions to /opt and /home/user"
RUN \
mkdir /context/ \
&& \
chown user:user /context/ \
&& \
mkdir /__w/ \
&& \
chown user:user /__w/ \
&& \
echo "/context/ /__w/ directories set up, user granted permissions"
USER user
# must be installed as user for executable to be available on PATH
RUN \
pip3 install --timeout 60 --retries 100 editorconfig-checker==2.3.54 \
&& \
ln -s /home/user/.local/bin/ec /home/user/.local/bin/editorconfig-checker \
&& \
echo "installed editorconfig-checker"
# adapted from https://askubuntu.com/a/799306
# and https://stackoverflow.com/a/38905161
ENV PATH "/home/user/.local/bin:$PATH"
CMD ["bash"]