Whamcloud - gitweb
LU-14189 contrib: docker example to build Lustre 00/40900/6
authorAlexey Zhuravlev <alexey@localhost.localdomain>
Mon, 7 Dec 2020 14:25:48 +0000 (17:25 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Apr 2023 06:27:12 +0000 (06:27 +0000)
can be easily modified for any target like specific RHEL, CentOS, etc

Test-Parameters: trivial
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I9f1abf653e0a89c5d115c53abc21df8d87b86e79
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/40900
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Deiter <alex.deiter@gmail.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/Dockerfile-centos7 [new file with mode: 0644]
contrib/Dockerfile-centos8 [new file with mode: 0644]

diff --git a/contrib/Dockerfile-centos7 b/contrib/Dockerfile-centos7
new file mode 100644 (file)
index 0000000..814decd
--- /dev/null
@@ -0,0 +1,81 @@
+# first, build docker image with:
+# $ podman build -t centos7-build -v <path-to-kernel>:/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=<path-to-kernel>,target=/tmp/kernel \
+#   --mount type=bind,source=<path-to-lustre>,target=/tmp/lustre \
+#   centos8-build /bin/bash -c "cd /tmp/lustre; sh autogen.sh; \
+#   ./configure --with-linux=<path-to-kernel> \
+#      --with-linux-obj=<path-to-kernel> --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 (file)
index 0000000..22907ca
--- /dev/null
@@ -0,0 +1,74 @@
+# first, build docker image with:
+# $ podman build -t centos8-build -v <path-to-kernel>:/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=<path-to-kernel>,target=/tmp/kernel \
+#   --mount type=bind,source=<path-to-lustre>,target=/tmp/lustre \
+#   centos8-build /bin/bash -c "cd /tmp/lustre; sh autogen.sh; \
+#   ./configure --with-linux=<path-to-kernel> \
+#      --with-linux-obj=<path-to-kernel> --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
+