From 07a303c971f2e2891173bd5bf1beba923428f550 Mon Sep 17 00:00:00 2001 From: Alexey Zhuravlev Date: Mon, 7 Dec 2020 17:25:48 +0300 Subject: [PATCH] LU-14189 contrib: docker example to build Lustre can be easily modified for any target like specific RHEL, CentOS, etc Test-Parameters: trivial Signed-off-by: Alex Zhuravlev Change-Id: I9f1abf653e0a89c5d115c53abc21df8d87b86e79 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/40900 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Deiter Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- contrib/Dockerfile-centos7 | 81 ++++++++++++++++++++++++++++++++++++++++++++++ contrib/Dockerfile-centos8 | 74 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 contrib/Dockerfile-centos7 create mode 100644 contrib/Dockerfile-centos8 diff --git a/contrib/Dockerfile-centos7 b/contrib/Dockerfile-centos7 new file mode 100644 index 0000000..814decd --- /dev/null +++ b/contrib/Dockerfile-centos7 @@ -0,0 +1,81 @@ +# first, build docker image with: +# $ podman build -t centos7-build -v :/tmp/linux-kernel \ +# -f Docker-centos7 . +# this builds and image without ZFS +# +# then use it to build Lustre: +# $ podman run -it +# --mount type=bind,source=,target=/tmp/kernel \ +# --mount type=bind,source=,target=/tmp/lustre \ +# centos8-build /bin/bash -c "cd /tmp/lustre; sh autogen.sh; \ +# ./configure --with-linux= \ +# --with-linux-obj= --disable-gss \ +# --disable-shared --disable-crypto; make" +# +# TODO: +# - add ZFS/SPL 0.7 to image +# - configurable zfs repo, zfs version/tag +# - move kernel to image +# + +FROM centos:7 + +RUN yum install -y gcc autoconf libtool which make patch diffutils file \ + binutils-devel install -y python38 python3-devel elfutils-devel \ + libselinux-devel libaio-devel libyaml-devel bc libnl3-devel bison \ + flex libmount-devel + +# to build lipe +RUN yum install -y json-c-devel redhat-lsb-core libssh-devel libattr-devel + +# to build ZFS +RUN yum install -y libtirpc-devel libblkid-devel openssl-devel libuuid-devel + +RUN yum install -y git + +#build and install latest e2fsprogs +RUN /bin/bash -c \ + "git clone git://git.whamcloud.com/tools/e2fsprogs.git e2fsprogs && \ + cd e2fsprogs && \ + git checkout -b v1.46.2.wc5 v1.46.2.wc5 && \ + ./configure --with-root-prefix=/usr --enable-elf-shlibs \ + --disable-uuidd --disable-fsck \ + --disable-e2initrd-helper \ + --disable-libblkid --disable-libuuid \ + --enable-quota --disable-fuse2fs && \ + make -j8 && make install && cd .. && rm -rf e2fsprogs" + +# to build zfs we need the kernel built +RUN /bin/bash -c \ + "cd /tmp/linux-kernel; [[ ! -s arch/x86/boot/bzImage ]] && make oldconfig && make -j8 bzImage" + +# build and install ZFS +RUN /bin/bash -c \ + "git clone https://github.com/zfsonlinux/spl spl && \ + cd spl && \ + git checkout -b splbuild spl-0.7.13 && \ + sed -i 's/CDDL/GPL/' META && \ + ./autogen.sh && \ + ./configure --with-linux=/tmp/linux-kernel \ + --with-linux-obj=/tmp/linux-kernel \ + --prefix=/usr && \ + make -j8 && \ + make install && \ + rm -rf spl" + +RUN /bin/bash -c \ + "git clone https://github.com/zfsonlinux/zfs zfs && \ + cd zfs && \ + git checkout -b zfsbuild zfs-0.7.13 && \ + sed -i 's/CDDL/GPL/' META && \ + ./autogen.sh && \ + ./configure --with-linux=/tmp/linux-kernel \ + --with-linux-obj=/tmp/linux-kernel \ + --prefix=/usr && \ + make -j8 && \ + make install && \ + rm -rf zfs" + +RUN yum remove -y git +RUN yum clean all + diff --git a/contrib/Dockerfile-centos8 b/contrib/Dockerfile-centos8 new file mode 100644 index 0000000..22907ca --- /dev/null +++ b/contrib/Dockerfile-centos8 @@ -0,0 +1,74 @@ +# first, build docker image with: +# $ podman build -t centos8-build -v :/tmp/linux-kernel \ +# -f Dockerfile-centos8 +# this builds a image with ZFS cloned from original repo +# +# then use it to build Lustre: +# $ podman run -it +# --mount type=bind,source=,target=/tmp/kernel \ +# --mount type=bind,source=,target=/tmp/lustre \ +# centos8-build /bin/bash -c "cd /tmp/lustre; sh autogen.sh; \ +# ./configure --with-linux= \ +# --with-linux-obj= --disable-gss \ +# --disable-shared --disable-crypto; make" +# +# TODO: +# - configurable zfs repo, zfs version/tag +# - move kernel to image +# + +FROM docker.io/library/centos:8 + +# Centos8 is EOL +RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* +RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* + +RUN dnf install -y gcc autoconf libtool which make patch diffutils file \ + binutils-devel python38 python3-devel elfutils-devel e2fsprogs-devel \ + libselinux-devel libaio-devel dnf-plugins-core bc bison flex +RUN yum config-manager --set-enabled powertools +RUN yum install -y libyaml-devel libnl3-devel libmount-devel + +# to build lipe +RUN dnf install -y json-c-devel redhat-lsb libssh-devel libattr-devel + +# to build zfs we need the kernel built +RUN /bin/bash -c \ + "cd /tmp/linux-kernel; [[ ! -s arch/x86/boot/bzImage ]] && make oldconfig && make -j8 bzImage" + +# to build ZFS +RUN dnf install -y libtirpc-devel libblkid-devel openssl-devel libuuid-devel + +RUN dnf install -y git + +#build and install latest e2fsprogs +RUN /bin/bash -c \ + "git clone git://git.whamcloud.com/tools/e2fsprogs.git e2fsprogs && \ + cd e2fsprogs && \ + git checkout -b v1.46.2.wc5 v1.46.2.wc5 && \ + ./configure --with-root-prefix=/usr --enable-elf-shlibs \ + --disable-uuidd --disable-fsck \ + --disable-e2initrd-helper \ + --disable-libblkid --disable-libuuid \ + --enable-quota --disable-fuse2fs && \ + make -j8 && make install && cd .. && rm -rf e2fsprogs" + + +# build and install ZFS +RUN /bin/bash -c \ + "rm -rf zfs && \ + git clone https://github.com/zfsonlinux/zfs zfs && \ + cd zfs && \ + git checkout -b zfs-2.1.2 zfs-2.1.2 && \ + sed -i 's/CDDL/GPL/' META && \ + ./autogen.sh && \ + ./configure \ + --with-linux=/tmp/linux-kernel \ + --with-linux-obj=/tmp/linux-kernel --prefix=/usr && \ + make -j8 && \ + make install && \ + cd .. && rm -rf zfs" + +RUN dnf remove -y git +RUN dnf clean all + -- 1.8.3.1