-
Notifications
You must be signed in to change notification settings - Fork 51
/
Dockerfile
210 lines (189 loc) · 9.83 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
# manylinux2010 wheels
# https://github.com/pypa/manylinux
#
FROM quay.io/pypa/manylinux2010_x86_64 as build-env
# FROM quay.io/pypa/manylinux1_x86_64 as build-env
ENV DEBIAN_FRONTEND noninteractive
# Python 3.8-3.12 via "38 39 311 312"
ARG PY_VERSIONS="38 39 310 311 312"
# static libs need relocatable symbols for linking to shared python lib
ENV CFLAGS="-fPIC ${CFLAGS}"
ENV CXXFLAGS="-fPIC ${CXXFLAGS}"
# install dependencies
# CMake, zlib?, HDF5, c-blosc, ADIOS2
RUN yum check-update -y \
; yum -y install \
glibc-static \
tar
#RUN curl -sOL https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-Linux-x86_64.tar.gz \
# && file cmake*.tar.gz \
# && tar -xzf cmake*.tar.gz \
# && rm cmake*.tar.gz \
# && mv cmake* /opt/cmake
#ENV PATH=/opt/cmake/bin:${PATH}
RUN for PY_TARGET in ${PY_VERSIONS}; do \
PY_BIN=/opt/python/cp${PY_TARGET:0:2}-cp${PY_TARGET}/bin/python \
&& ${PY_BIN} -m pip install -U pip \
&& ${PY_BIN} -m pip install -U setuptools cmake; \
done;
RUN curl -sLo hdf5-1.10.5.tar.gz https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/hdf5-1.10.5.tar.gz \
&& file hdf5*.tar.gz \
&& tar -xzf hdf5*.tar.gz \
&& rm hdf5*.tar.gz \
&& cd hdf5-* \
&& ./configure --disable-parallel --disable-shared --enable-static --prefix /usr \
&& make \
&& make install
# avoid picking up a static libpthread (also: those libs lack -fPIC)
RUN rm -f /usr/lib64/libpthread.a /usr/lib64/libm.a /usr/lib64/librt.a
RUN rm -f /usr/lib/libpthread.a /usr/lib/libm.a /usr/lib/librt.a
RUN curl -sLo c-blosc-1.15.0.tar.gz https://github.com/Blosc/c-blosc/archive/v1.15.0.tar.gz \
&& file c-blosc*.tar.gz \
&& tar -xzf c-blosc*.tar.gz \
&& rm c-blosc*.tar.gz \
&& mkdir build-c-blosc \
&& cd build-c-blosc \
&& PY_TARGET=${PY_VERSIONS%% *} \
&& PY_BIN=/opt/python/cp${PY_TARGET:0:2}-cp${PY_TARGET}/bin/python \
&& CMAKE_BIN="$(${PY_BIN} -m pip show cmake 2>/dev/null | grep Location | cut -d' ' -f2)/cmake/data/bin/" \
&& PATH=${CMAKE_BIN}:${PATH} cmake -DDEACTIVATE_SNAPPY=ON -DBUILD_SHARED=OFF -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF -DPREFER_EXTERNAL_ZLIB=ON -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr ../c-blosc-* \
&& make \
&& make install
RUN curl -sLo adios2-2.7.1.tar.gz https://github.com/ornladios/ADIOS2/archive/v2.7.1.tar.gz \
&& file adios2*.tar.gz \
&& tar -xzf adios2*.tar.gz \
&& rm adios2*.tar.gz \
&& mkdir build-ADIOS2 \
&& cd build-ADIOS2 \
&& PY_TARGET=${PY_VERSIONS%% *} \
&& PY_BIN=/opt/python/cp${PY_TARGET:0:2}-cp${PY_TARGET}/bin/python \
&& CMAKE_BIN="$(${PY_BIN} -m pip show cmake 2>/dev/null | grep Location | cut -d' ' -f2)/cmake/data/bin/" \
&& PATH=${CMAKE_BIN}:${PATH} cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DADIOS2_BUILD_EXAMPLES=OFF -DADIOS2_BUILD_TESTING=OFF -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_DISABLE_FIND_PACKAGE_LibFFI=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_BISON=TRUE -DCMAKE_INSTALL_PREFIX=/usr ../ADIOS2-* \
&& make \
&& make install
ADD . /opt/src
RUN ls /opt/python/
ENV HDF5_USE_STATIC_LIBRARIES=ON \
ZLIB_USE_STATIC_LIBS=ON \
openPMD_BUILD_TESTING=OFF \
openPMD_BUILD_EXAMPLES=OFF
# build matrix
RUN cd /opt/src; \
for PY_TARGET in ${PY_VERSIONS}; do \
PY_BIN=/opt/python/cp${PY_TARGET:0:2}-cp${PY_TARGET}/bin/python \
&& CMAKE_BIN="$(${PY_BIN} -m pip show cmake 2>/dev/null | grep Location | cut -d' ' -f2)/cmake/data/bin/" \
&& PATH=${CMAKE_BIN}:${PATH} ${PY_BIN} setup.py bdist_wheel \
&& ${PY_BIN} setup.py clean --all \
&& rm -rf openPMD_api.egg-info/; \
done; \
ls dist/
#RUN mkdir build \
# && cd build \
# && /opt/cmake/bin/cmake \
# -DPython_ROOT_DIR=$(which /opt/python/cp${PY_TARGET}-cp${PY_TARGET}m) \
# -DHDF5_USE_STATIC_LIBRARIES=ON \
# -DZLIB_USE_STATIC_LIBS=ON \
# -DBUILD_SHARED_LIBS=OFF \
# -DopenPMD_BUILD_TESTING=OFF \
# -DopenPMD_BUILD_EXAMPLES=OFF \
# /opt/src \
# && make
# verify wheel
# https://github.com/pypa/auditwheel
#RUN pip install auditwheel # already installed
RUN for whl in /opt/src/dist/*.whl; do \
auditwheel show ${whl} && \
auditwheel repair --plat manylinux2010_x86_64 ${whl}; \
done \
&& du -hs /opt/src/dist/* \
&& du -hs /wheelhouse/*
# test in fresh env: Debian:Sid + Python 3.8
FROM debian:sid
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp38-cp38-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.8 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.8 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.8 get-pip.py \
&& python3.8 -m pip install openPMD_api-*-cp38-cp38-manylinux2010_x86_64.whl
RUN python3.8 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.8 -m openpmd_api.ls --help
RUN openpmd-ls --help
# test in fresh env: Debian:Bullseye + Python 3.9
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp39-cp39-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.9 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.9 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.9 get-pip.py \
&& python3.9 -m pip install openPMD_api-*-cp39-cp39-manylinux2010_x86_64.whl
RUN python3.9 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.9 -m openpmd_api.ls --help
RUN openpmd-ls --help
# test in fresh env: Debian:Bullseye + Python 3.10
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp310-cp310-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.10 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.10 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.10 get-pip.py \
&& python3.10 -m pip install openPMD_api-*-cp310-cp310-manylinux2010_x86_64.whl
RUN python3.10 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.10 -m openpmd_api.ls --help
RUN openpmd-ls --help
# test in fresh env: Debian:Bullseye + Python 3.11
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp311-cp311-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.11 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.11 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.11 get-pip.py \
&& python3.11 -m pip install openPMD_api-*-cp311-cp311-manylinux2010_x86_64.whl
RUN python3.11 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.11 -m openpmd_api.ls --help
RUN openpmd-ls --help
# test in fresh env: Debian:Bullseye + Python 3.12
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp312-cp312-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.12 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.12 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.12 get-pip.py \
&& python3.12 -m pip install openPMD_api-*-cp312-cp312-manylinux2010_x86_64.whl
RUN python3.12 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.12 -m openpmd_api.ls --help
RUN openpmd-ls --help
# test in fresh env: Debian:Bullseye + Python 3.13
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
COPY --from=build-env /wheelhouse/openPMD_api-*-cp313-cp313-manylinux2010_x86_64.whl .
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3.13 python3-distutils ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN python3.13 --version \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.13 get-pip.py \
&& python3.13 -m pip install openPMD_api-*-cp313-cp313-manylinux2010_x86_64.whl
RUN python3.13 -c "import openpmd_api as io; print(io.__version__); print(io.variants)"
RUN python3.13 -m openpmd_api.ls --help
RUN openpmd-ls --help
# copy binary artifacts (wheels)
FROM quay.io/pypa/manylinux2010_x86_64
MAINTAINER Axel Huebl <[email protected]>
COPY --from=build-env /wheelhouse/openPMD_api-*.whl /opt/wheels/
RUN ls /opt/wheels/
ENTRYPOINT if [ -d /dist ]; then cp /opt/wheels/* /dist/; fi