-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
335 lines (266 loc) · 10.9 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
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
# Dockerfile giving an environment in which Bempp-cl can be run
#
# Docker images created by this file are pushed to hub.docker.com/u/bempp
#
# Authors:
# Matthew Scroggs <mws48@cam.ac.uk>
# Timo Betcke <t.betcke@ucl.ac.uk>
#
# Based on the FEniCSx Docker file written by:
# Jack S. Hale <jack.hale@uni.lu>
# Lizao Li <lzlarryli@gmail.com>
# Garth N. Wells <gnw20@cam.ac.uk>
# Jan Blechta <blechta@karlin.mff.cuni.cz>
#
#
ARG GMSH_VERSION=4.11.1
ARG TINI_VERSION=0.19.0
ARG EXAFMM_VERSION=0.1.1
ARG FENICSX_BASIX_TAG=main
ARG FENICSX_FFCX_TAG=main
ARG FENICSX_DOLFINX_TAG=main
ARG FENICSX_UFL_TAG=main
ARG MAKEFLAGS
########################################
FROM ubuntu:24.04 as bempp-dev-env
LABEL maintainer="Matthew Scroggs <bempp@mscroggs.co.uk>"
LABEL description="Bempp-cl development environment"
ARG GMSH_VERSION
ARG MAKEFLAGS
ARG EXAFMM_VERSION
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -qq update && \
apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \
apt-get -y install \
wget \
git \
pkg-config \
build-essential \
# ExaFMM dependencies
libfftw3-dev \
libopenblas-dev \
# Gmsh dependencies
libfltk-gl1.3 \
libfltk-images1.3 \
libfltk1.3 \
libglu1-mesa \
# OpenCL
libpocl-dev \
# Python
python3-dev \
python3-venv \
python3-pip \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV VIRTUAL_ENV /bempp-env
ENV PATH /bempp-env/bin:$PATH
RUN python3 -m venv ${VIRTUAL_ENV}
# Install Python packages (via pip)
RUN python3 -m pip install --no-cache-dir matplotlib pyopencl numpy scipy numba meshio && \
python3 -m pip install --no-cache-dir flake8 pytest pydocstyle pytest-xdist
# Download Install Gmsh SDK
RUN cd /usr/local && \
wget -nc --quiet http://gmsh.info/bin/Linux/gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \
tar -xf gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \
rm gmsh-${GMSH_VERSION}-Linux64-sdk.tgz
ENV PATH=/usr/local/gmsh-${GMSH_VERSION}-Linux64-sdk/bin:$PATH
RUN git clone -b v${EXAFMM_VERSION} https://github.com/exafmm/exafmm-t.git
RUN cd exafmm-t && sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install .
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
########################################
FROM ubuntu:24.04 as bempp-dev-env-numba
LABEL maintainer="Matthew Scroggs <bempp@mscroggs.co.uk>"
LABEL description="Bempp-cl development environment"
ARG GMSH_VERSION
ARG MAKEFLAGS
ARG EXAFMM_VERSION
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -qq update && \
apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \
apt-get -y install \
wget \
git \
pkg-config \
build-essential \
# ExaFMM dependencies
libfftw3-dev \
libopenblas-dev \
# Gmsh dependencies
libfltk-gl1.3 \
libfltk-images1.3 \
libfltk1.3 \
libglu1-mesa \
# Python
python3-dev \
python3-venv \
python3-pip \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV VIRTUAL_ENV /bempp-env
ENV PATH /bempp-env/bin:$PATH
RUN python3 -m venv ${VIRTUAL_ENV}
RUN python3 -m pip install --no-cache-dir matplotlib numpy scipy numba meshio && \
python3 -m pip install --no-cache-dir flake8 pytest pydocstyle pytest-xdist
# Download Install Gmsh SDK
RUN cd /usr/local && \
wget -nc --quiet http://gmsh.info/bin/Linux/gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \
tar -xf gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \
rm gmsh-${GMSH_VERSION}-Linux64-sdk.tgz
ENV PATH=/usr/local/gmsh-${GMSH_VERSION}-Linux64-sdk/bin:$PATH
RUN git clone -b v${EXAFMM_VERSION} https://github.com/exafmm/exafmm-t.git
RUN cd exafmm-t && sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install .
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
########################################
FROM ghcr.io/fenics/test-env:current-openmpi as bempp-dev-env-with-dolfinx
LABEL maintainer="Matthew Scroggs <bempp@mscroggs.co.uk>"
LABEL description="Bempp-cl development environment with FEniCSx"
ARG DOLFINX_MAKEFLAGS
ARG FENICSX_BASIX_TAG
ARG FENICSX_FFCX_TAG
ARG FENICSX_DOLFINX_TAG
ARG FENICSX_UFL_TAG
ARG BEMPP_VERSION
ARG EXAFMM_VERSION
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -qq update && \
apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \
apt-get -y install \
# OpenCL
libpocl-dev \
# ExaFMM dependencies
libfftw3-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Python packages (via pip)
RUN python3 -m pip install --no-cache-dir nanobind scikit-build-core[pyproject] && \
python3 -m pip install --no-cache-dir matplotlib pyopencl numpy scipy numba meshio pyopencl && \
python3 -m pip install --no-cache-dir flake8 pytest pydocstyle pytest-xdist
# Install UFL, Basix and FFCx
RUN python3 -m pip install --no-cache-dir ipython && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/basix.git@${FENICSX_BASIX_TAG} && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG}
ENV PETSC_ARCH=linux-gnu-complex128-32
# Install DOLFINx
RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenics/dolfinx.git
RUN mkdir dolfinx/build
RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-complex -DDOLFINX_ENABLE_PETSC=true -B dolfinx/build -S dolfinx/cpp
RUN cmake --build dolfinx/build && cmake --install dolfinx/build
ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH
ENV PATH=/usr/local/dolfinx-complex/bin:$PATH
ENV PKG_CONFIG_PATH=/usr/local/dolfinx-complex/lib/pkgconfig:$PKG_CONFIG_PATH
ENV CMAKE_PREFIX_PATH=/usr/local/dolfinx-complex/lib/cmake:$CMAKE_PREFIX_PATH
RUN cd dolfinx/python && \
python3 -m pip install -r build-requirements.txt && \
python3 -m pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Release" .
# Download and install ExaFMM
RUN wget -nc --quiet https://github.com/exafmm/exafmm-t/archive/v${EXAFMM_VERSION}.tar.gz && \
tar -xf v${EXAFMM_VERSION}.tar.gz && \
cd exafmm-t-${EXAFMM_VERSION} && \
sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install .
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
########################################
FROM ghcr.io/fenics/test-env:current-openmpi as bempp-dev-env-with-dolfinx-numba
LABEL maintainer="Matthew Scroggs <bempp@mscroggs.co.uk>"
LABEL description="Bempp-cl development environment with FEniCSx (Numba only)"
ARG DOLFINX_MAKEFLAGS
ARG FENICSX_BASIX_TAG
ARG FENICSX_FFCX_TAG
ARG FENICSX_DOLFINX_TAG
ARG FENICSX_UFL_TAG
ARG BEMPP_VERSION
ARG EXAFMM_VERSION
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -qq update && \
apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \
apt-get -y install \
# ExaFMM dependencies
libfftw3-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Python packages (via pip)
RUN python3 -m pip install --no-cache-dir nanobind scikit-build-core[pyproject] && \
python3 -m pip install --no-cache-dir meshio numpy matplotlib
# Install UFL, Basix and FFCx
RUN python3 -m pip install --no-cache-dir ipython && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/basix.git@${FENICSX_BASIX_TAG} && \
python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG}
ENV PETSC_ARCH=linux-gnu-complex128-32
# Install DOLFINx
RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenics/dolfinx.git
RUN mkdir dolfinx/build
RUN cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-complex -DDOLFINX_ENABLE_PETSC=true -B dolfinx/build -S dolfinx/cpp
RUN cmake --build dolfinx/build && cmake --install dolfinx/build
ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH
ENV PATH=/usr/local/dolfinx-complex/bin:$PATH
ENV PKG_CONFIG_PATH=/usr/local/dolfinx-complex/lib/pkgconfig:$PKG_CONFIG_PATH
ENV CMAKE_PREFIX_PATH=/usr/local/dolfinx-complex/lib/cmake:$CMAKE_PREFIX_PATH
RUN cd dolfinx/python && \
python3 -m pip install -r build-requirements.txt && \
python3 -m pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Release" .
# Download and install ExaFMM
RUN wget -nc --quiet https://github.com/exafmm/exafmm-t/archive/v${EXAFMM_VERSION}.tar.gz && \
tar -xf v${EXAFMM_VERSION}.tar.gz && \
cd exafmm-t-${EXAFMM_VERSION} && \
sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install .
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
########################################
FROM bempp-dev-env-with-dolfinx as with-dolfinx
LABEL description="Bempp-cl environment with FEniCSx"
WORKDIR /tmp
RUN git clone https://github.com/bempp/bempp-cl
RUN cd bempp-cl && python3 -m pip install .
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
########################################
FROM bempp-dev-env-with-dolfinx as lab
LABEL description="Bempp Jupyter Lab"
WORKDIR /tmp
RUN git clone https://github.com/bempp/bempp-cl
RUN cd bempp-cl && python3 -m pip install .
RUN python3 -m pip install --no-cache-dir jupytext
RUN python3 bempp-cl/examples/generate_notebooks.py --run false
RUN cp -r bempp-cl/examples/notebooks /root/example_notebooks
RUN python3 -m pip uninstall -y jupytext
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
ARG TINI_VERSION
ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini
RUN chmod +x /tini && \
python3 -m pip install --no-cache-dir jupyter jupyterlab plotly
EXPOSE 8888/tcp
ENTRYPOINT ["/tini", "--", "jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--allow-root"]
########################################
FROM bempp-dev-env-with-dolfinx-numba as numba-lab
LABEL description="Bempp Jupyter Lab (Numba only)"
WORKDIR /tmp
RUN git clone https://github.com/bempp/bempp-cl
RUN cd bempp-cl && python3 -m pip install .
RUN python3 -m pip install --no-cache-dir jupytext
RUN python3 bempp-cl/examples/generate_notebooks.py --run false
RUN cp -r bempp-cl/examples/notebooks /root/example_notebooks
RUN python3 -m pip uninstall -y jupytext
# Clear /tmp
RUN rm -rf /tmp/*
WORKDIR /root
ARG TINI_VERSION
ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini
RUN chmod +x /tini && \
python3 -m pip install --no-cache-dir jupyter jupyterlab plotly
EXPOSE 8888/tcp
ENTRYPOINT ["/tini", "--", "jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--allow-root"]