diff --git a/Dockerfile.dapper b/Dockerfile.dapper index c2ff36201..c08b7dd3c 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -21,6 +21,10 @@ RUN zypper refresh && \ zypper -n --gpg-auto-import-keys ref # Install packages +RUN if [ ${ARCH} == "amd64" ]; then \ + zypper -n install autoconf libtool libunwind-devel; \ + fi + RUN zypper -n install cmake wget curl git less file \ libglib-2_0-0 libkmod-devel libnl3-devel linux-glibc-devel pkg-config \ psmisc tox qemu-tools fuse python3-devel git zlib-devel zlib-devel-static \ @@ -41,20 +45,46 @@ ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm64=arm64 GOLANG_ARCH_s390x=s390x GOLA RUN wget -O - https://storage.googleapis.com/golang/go1.14.15.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \ go get github.com/rancher/trash && go get -u golang.org/x/lint/golint +# Build gperftools +# 1. Just use tcmalloc lib from gperftools installation +# 2. tcmalloc also supports arm64 platform, but we only focus on amd64 first currently. +# arm64 will be supported after more testing. +RUN if [ ${ARCH} == "amd64" ]; then \ + cd /usr/src && \ + git clone https://github.com/gperftools/gperftools.git&& \ + cd gperftools && \ + git checkout db6d94d9893fdd8c74028b5113cd9185be1e3111 && \ + ./autogen.sh && \ + ./configure && \ + make && \ + make install; \ + zypper -n remove autoconf libtool libunwind-devel; \ + rm -rf /usr/src/gperftools; \ + ldconfig; \ + fi + # Build liblonghorn RUN cd /usr/src && \ git clone https://github.com/rancher/liblonghorn.git && \ cd liblonghorn && \ - git checkout 6544c2432d543137a198e4a779f676369dbd9e82 && \ - make && \ + git checkout fe86d7f1c6780904760f2832d8055c7ca7f0d92a && \ + if [ ${ARCH} == "amd64" ]; then \ + make EXTRA_LIBS=/usr/local/lib/libtcmalloc.a; \ + else \ + make; \ + fi; \ make install # Build TGT RUN cd /usr/src && \ git clone https://github.com/rancher/tgt.git && \ cd tgt && \ - git checkout e042fdd3616ca90619637b5826695a3de9b5dd8e && \ - make && \ + git checkout 64a3443ad6ab829343167e744a757d8ec044185a && \ + if [ ${ARCH} == "amd64" ]; then \ + make EXTRA_LIBS=-ltcmalloc; \ + else \ + make; \ + fi; \ make install # Install libqcow to resolve error: diff --git a/package/Dockerfile b/package/Dockerfile index 004fd0e8d..7ebdff74c 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -12,6 +12,10 @@ RUN zypper -n install cmake kmod curl nfs-client nfs4-acl-tools fuse git gcc \ iputils telnet iperf qemu-tools wget iproute2 xsltproc docbook-xsl-stylesheets \ e2fsprogs e2fsprogs-devel xfsprogs xfsprogs-devel +RUN if [ ${ARCH} == "amd64" ]; then \ + zypper -n install autoconf libtool libunwind-devel gcc-c++; \ + fi + # Install grpc_health_probe RUN wget https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.2/grpc_health_probe-linux-${ARCH} -O /usr/local/bin/grpc_health_probe && \ chmod +x /usr/local/bin/grpc_health_probe @@ -20,23 +24,47 @@ COPY bin/longhorn-instance-manager /usr/local/bin/ COPY package/engine-manager /usr/local/bin/ +# Build gperftools +# 1. Just use tcmalloc lib from gperftools installation +# 2. tcmalloc also supports arm64 platform, but we only focus on amd64 first currently. +# arm64 will be supported after more testing. +RUN if [ ${ARCH} == "amd64" ]; then \ + cd /usr/src && \ + git clone https://github.com/gperftools/gperftools.git&& \ + cd gperftools && \ + git checkout db6d94d9893fdd8c74028b5113cd9185be1e3111 && \ + ./autogen.sh && \ + ./configure && \ + make && \ + make install; \ + zypper -n remove autoconf libtool libunwind-devel gcc-c++; \ + rm -rf /usr/src/gperftools; \ + ldconfig; \ + fi + # Build liblonghorn RUN cd /usr/src && \ git clone https://github.com/rancher/liblonghorn.git && \ cd liblonghorn && \ - git checkout 74f14b50895ac6b0faebc715c025a8a46a4333a1 && \ - make && \ - make install && \ - rm -rf /usr/src/liblonghorn + git checkout fe86d7f1c6780904760f2832d8055c7ca7f0d92a && \ + if [ ${ARCH} == "amd64" ]; then \ + make EXTRA_LIBS=/usr/local/lib/libtcmalloc.a; \ + else \ + make; \ + fi; \ + make install # Build TGT RUN cd /usr/src && \ git clone https://github.com/rancher/tgt.git && \ cd tgt && \ - git checkout e042fdd3616ca90619637b5826695a3de9b5dd8e && \ - make && \ - make install && \ - rm -rf /usr/src/tgt + git checkout 64a3443ad6ab829343167e744a757d8ec044185a && \ + if [ ${ARCH} == "amd64" ]; then \ + make EXTRA_LIBS=-ltcmalloc; \ + else \ + make; \ + fi; \ + make install VOLUME /usr/local/bin