From 66cf305a40cf42e0598d7b2fee902ab89a9a2fb0 Mon Sep 17 00:00:00 2001 From: q-posev Date: Thu, 16 Sep 2021 15:31:11 +0200 Subject: [PATCH] add Docker files and bash scripts to build HDF5 1.12 in manylinux containers --- docker/hdf5-on-docker/Dockerfile_2010_x86_64 | 15 ++++++++ docker/hdf5-on-docker/Dockerfile_2014_aarch64 | 15 ++++++++ docker/hdf5-on-docker/Dockerfile_2014_x86_64 | 10 ++++++ docker/hdf5-on-docker/Dockerfile_2_24_aarch64 | 10 ++++++ docker/hdf5-on-docker/Dockerfile_2_24_x86_64 | 10 ++++++ docker/hdf5-on-docker/build_images.sh | 16 +++++++++ docker/hdf5-on-docker/install_hdf5_centos.sh | 34 +++++++++++++++++++ docker/hdf5-on-docker/install_hdf5_debian.sh | 32 +++++++++++++++++ docker/hdf5-on-docker/install_libaec.sh | 28 +++++++++++++++ 9 files changed, 170 insertions(+) create mode 100644 docker/hdf5-on-docker/Dockerfile_2010_x86_64 create mode 100644 docker/hdf5-on-docker/Dockerfile_2014_aarch64 create mode 100644 docker/hdf5-on-docker/Dockerfile_2014_x86_64 create mode 100644 docker/hdf5-on-docker/Dockerfile_2_24_aarch64 create mode 100644 docker/hdf5-on-docker/Dockerfile_2_24_x86_64 create mode 100755 docker/hdf5-on-docker/build_images.sh create mode 100644 docker/hdf5-on-docker/install_hdf5_centos.sh create mode 100644 docker/hdf5-on-docker/install_hdf5_debian.sh create mode 100644 docker/hdf5-on-docker/install_libaec.sh diff --git a/docker/hdf5-on-docker/Dockerfile_2010_x86_64 b/docker/hdf5-on-docker/Dockerfile_2010_x86_64 new file mode 100644 index 0000000..259c887 --- /dev/null +++ b/docker/hdf5-on-docker/Dockerfile_2010_x86_64 @@ -0,0 +1,15 @@ +# =========================================================================== +# Script from the hdf5-manylinux repo: +# https://github.com/h5py/hdf5-manylinux/blob/master/Dockerfile_x86_64 +# =========================================================================== + +FROM quay.io/pypa/manylinux2010_x86_64 + +ENV HDF5_DIR /usr/local +ENV HDF5_VERSION 1.12.1 + +COPY install_libaec.sh /tmp/install_libaec.sh +RUN bash /tmp/install_libaec.sh +COPY install_hdf5_centos.sh /tmp/install_hdf5.sh +RUN bash /tmp/install_hdf5.sh + diff --git a/docker/hdf5-on-docker/Dockerfile_2014_aarch64 b/docker/hdf5-on-docker/Dockerfile_2014_aarch64 new file mode 100644 index 0000000..b021a9a --- /dev/null +++ b/docker/hdf5-on-docker/Dockerfile_2014_aarch64 @@ -0,0 +1,15 @@ +# =========================================================================== +# Script from the hdf5-manylinux repo: +# https://github.com/h5py/hdf5-manylinux/blob/master/Dockerfile_aarch64 +# =========================================================================== + +FROM quay.io/pypa/manylinux2014_aarch64 + +ENV HDF5_DIR /usr/local +ENV HDF5_VERSION 1.12.1 + +COPY install_libaec.sh /tmp/install_libaec.sh +RUN bash /tmp/install_libaec.sh +COPY install_hdf5_centos.sh /tmp/install_hdf5.sh +RUN bash /tmp/install_hdf5.sh + diff --git a/docker/hdf5-on-docker/Dockerfile_2014_x86_64 b/docker/hdf5-on-docker/Dockerfile_2014_x86_64 new file mode 100644 index 0000000..49df22c --- /dev/null +++ b/docker/hdf5-on-docker/Dockerfile_2014_x86_64 @@ -0,0 +1,10 @@ +FROM quay.io/pypa/manylinux2014_x86_64 + +ENV HDF5_DIR /usr/local +ENV HDF5_VERSION 1.12.1 + +COPY install_libaec.sh /tmp/install_libaec.sh +RUN bash /tmp/install_libaec.sh +COPY install_hdf5_centos.sh /tmp/install_hdf5.sh +RUN bash /tmp/install_hdf5.sh + diff --git a/docker/hdf5-on-docker/Dockerfile_2_24_aarch64 b/docker/hdf5-on-docker/Dockerfile_2_24_aarch64 new file mode 100644 index 0000000..2da43cc --- /dev/null +++ b/docker/hdf5-on-docker/Dockerfile_2_24_aarch64 @@ -0,0 +1,10 @@ +FROM quay.io/pypa/manylinux_2_24_aarch64 + +ENV HDF5_DIR /usr/local +ENV HDF5_VERSION 1.12.1 + +COPY install_libaec.sh /tmp/install_libaec.sh +RUN bash /tmp/install_libaec.sh +COPY install_hdf5_debian.sh /tmp/install_hdf5.sh +RUN bash /tmp/install_hdf5.sh + diff --git a/docker/hdf5-on-docker/Dockerfile_2_24_x86_64 b/docker/hdf5-on-docker/Dockerfile_2_24_x86_64 new file mode 100644 index 0000000..c36adda --- /dev/null +++ b/docker/hdf5-on-docker/Dockerfile_2_24_x86_64 @@ -0,0 +1,10 @@ +FROM quay.io/pypa/manylinux_2_24_x86_64 + +ENV HDF5_DIR /usr/local +ENV HDF5_VERSION 1.12.1 + +COPY install_libaec.sh /tmp/install_libaec.sh +RUN bash /tmp/install_libaec.sh +COPY install_hdf5_debian.sh /tmp/install_hdf5.sh +RUN bash /tmp/install_hdf5.sh + diff --git a/docker/hdf5-on-docker/build_images.sh b/docker/hdf5-on-docker/build_images.sh new file mode 100755 index 0000000..9936b83 --- /dev/null +++ b/docker/hdf5-on-docker/build_images.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -x +set -e + +# currently cannot build ARM64 images on the AMD64 platform due to the error: +# standard_init_linux.go:219: exec user process caused: exec format error +#for tag in 2010_x86_64 2014_x86_64 2_24_x86_64 2014_aarch64 2_24_aarch64 + +# build only x86_64 images +for tag in 2010_x86_64 2014_x86_64 2_24_x86_64 +do + echo "Building image on ${tag} platform" + docker build -t hdf5_1_12_on_${tag} . -f Dockerfile_${tag} +done + diff --git a/docker/hdf5-on-docker/install_hdf5_centos.sh b/docker/hdf5-on-docker/install_hdf5_centos.sh new file mode 100644 index 0000000..9f5bae6 --- /dev/null +++ b/docker/hdf5-on-docker/install_hdf5_centos.sh @@ -0,0 +1,34 @@ +# =========================================================================== +# Script from the hdf5-manylinux repo: +# https://github.com/h5py/hdf5-manylinux/blob/master/install_hdf5.sh +# =========================================================================== + +set -euo pipefail + +echo "Installing zlib with yum" +yum -y install zlib-devel + +pushd /tmp + +# This seems to be needed to find libsz.so.2 +ldconfig + +echo "Downloading & unpacking HDF5 ${HDF5_VERSION}" +# Remove trailing .*, to get e.g. '1.12' ↓ +curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz" +tar -xzvf hdf5-$HDF5_VERSION.tar.gz +pushd hdf5-$HDF5_VERSION +chmod u+x autogen.sh + +echo "Configuring, building & installing HDF5 ${HDF5_VERSION} to ${HDF5_DIR}" +./configure --prefix $HDF5_DIR --enable-build-mode=production --with-szlib +make -j $(nproc) +make install +popd + +# Clean up to limit the size of the Docker image +echo "Cleaning up unnecessary files" +rm -r hdf5-$HDF5_VERSION +rm hdf5-$HDF5_VERSION.tar.gz + +yum -y erase zlib-devel diff --git a/docker/hdf5-on-docker/install_hdf5_debian.sh b/docker/hdf5-on-docker/install_hdf5_debian.sh new file mode 100644 index 0000000..613224d --- /dev/null +++ b/docker/hdf5-on-docker/install_hdf5_debian.sh @@ -0,0 +1,32 @@ +# =========================================================================== +# Debian-adapted script from the hdf5-manylinux repo: +# https://github.com/h5py/hdf5-manylinux/blob/master/install_hdf5.sh +# =========================================================================== + + +set -euo pipefail + +pushd /tmp + +# This seems to be needed to find libsz.so.2 +ldconfig + +echo "Downloading & unpacking HDF5 ${HDF5_VERSION}" +# Remove trailing .*, to get e.g. '1.12' ↓ +curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz" +tar -xzvf hdf5-$HDF5_VERSION.tar.gz +pushd hdf5-$HDF5_VERSION +chmod u+x autogen.sh + +echo "Configuring, building & installing HDF5 ${HDF5_VERSION} to ${HDF5_DIR}" +./configure --prefix $HDF5_DIR --enable-build-mode=production --with-szlib +make -j $(nproc) +make install +popd + +# Clean up to limit the size of the Docker image +echo "Cleaning up unnecessary files" +rm -r hdf5-$HDF5_VERSION +rm hdf5-$HDF5_VERSION.tar.gz + +apt-get -y remove zlib1g-dev diff --git a/docker/hdf5-on-docker/install_libaec.sh b/docker/hdf5-on-docker/install_libaec.sh new file mode 100644 index 0000000..a300b5e --- /dev/null +++ b/docker/hdf5-on-docker/install_libaec.sh @@ -0,0 +1,28 @@ +# =========================================================================== +# Script from the hdf5-manylinux repo: +# https://github.com/h5py/hdf5-manylinux/blob/master/install_libaec.sh +# =========================================================================== + + +# libaec implements szip compression, so the optional szip filter can be built +# in HDF5. +set -euo pipefail + +pushd /tmp + +aec_version="1.0.4" + +echo "Downloading libaec" +# The URL includes a hash, so it needs to change if the version does +curl -fsSLO https://gitlab.dkrz.de/k202009/libaec/uploads/ea0b7d197a950b0c110da8dfdecbb71f/libaec-${aec_version}.tar.gz +tar zxf libaec-$aec_version.tar.gz + +echo "Building & installing libaec" +pushd libaec-$aec_version +./configure +make +make install + +# Clean up the files from the build +popd +rm -r libaec-$aec_version libaec-$aec_version.tar.gz