GreatSQL社区

搜索

[已解决] centos7构建 greatsql-8.0.32-24 docker编译环境

765 1 2023-8-30 10:38
  1. cat Dockerfile
  2. FROM centos:7
  3. ENV LANG en_US.utf8

  4. #ENV PATH="/usr/local/mysql/bin:${PATH}"
  5. #ENV LD_LIBRARY_PATH="/usr/local/mysql/lib:${LD_LIBRARY_PATH}"

  6. RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
  7. systemd-tmpfiles-setup.service ] || rm -f $i; done); \
  8. rm -f /lib/systemd/system/multi-user.target.wants/*;\
  9. rm -f /etc/systemd/system/*.wants/*;\
  10. rm -f /lib/systemd/system/local-fs.target.wants/*; \
  11. rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
  12. rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
  13. rm -f /lib/systemd/system/basic.target.wants/*;\
  14. rm -f /lib/systemd/system/anaconda.target.wants/*;

  15. RUN yum install -y epel-release

  16. #RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

  17. RUN yum clean all && \
  18. yum makecache

  19. RUN yum install -y --skip-broken yum-utils wget unzip tar vim file time rpm* git diffutils net-tools \
  20. gcc gcc-c++ clang ccache libtool psmisc flex valgrind \
  21. automake make cmake cmake3 pkg-config rpcgen \
  22. openssl openssl-devel libssh libssl \
  23. cyrus-sasl-devel cyrus-sasl-scram \
  24. pam pam-devel \
  25. openldap-devel openldap-clients \
  26. readline-devel expat-devel re2-devel \
  27. bison bison-devel \
  28. libaio-devel libevent-devel libicu-devel libffi-devel \
  29. libxml2-devel \
  30. libtirpc libtirpc-devel \
  31. libarchive libcurl-devel \
  32. ncurses-devel ncurses-libs \
  33. boost-devel \
  34. numactl numactl-devel numactl-libs \
  35. gflags-devel gtest-devel \
  36. libzstd libzstd-devel libzstd-static \
  37. patchelf \
  38. perl perl-Env perl-JSON perl-Memoize perl-Time-HiRes \
  39. bzip2 bzip2-devel snappy-devel zlib-devel lz4-devel lz4-static \
  40. jemalloc jemalloc-devel \
  41. python-devel \
  42. redhat-lsb-core centos-release-scl scl-utils-build

  43. RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
  44. RUN scl enable devtoolset-11 bash
  45. RUN echo 'scl enable devtoolset-11 bash' >> /root/.bash_profile


  46. # update patchelf 0.13
  47. COPY patchelf-0.13.tar.gz /tmp/
  48. RUN cd /tmp && tar -xzvf patchelf-0.13.tar.gz && cd patchelf-0.13 && ./bootstrap.sh && ./configure && make && make install

  49. COPY rpcsvc-proto-1.4.tar.gz /tmp/rpcsvc-proto-1.4.tar.gz
  50. RUN tar zxvf /tmp/rpcsvc-proto-1.4.tar.gz -C /tmp && cd /tmp/rpcsvc-proto-1.4/ && ./configure && make && make install

  51. RUN rm -fr /tmp/*

  52. #download boost-1.77 from https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz
  53. COPY boost_1_77_0.tar.gz /opt/

  54. COPY greatsql-automake.sh /opt/

  55. CMD ["/usr/sbin/init"]



  56. cat greatsql-docker-build.sh
  57. #!/bin/bash
  58. ##
  59. ## 自动构建GreatSQL Docker编译环境
  60. ##
  61. ## 文档:https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/user-manual/4-install-guide/4-6-install-with-source-code.md
  62. ##

  63. docker build -t greatsql_build_env .

  64. src_dir=$1

  65. if [ $? -ne 0 ];then
  66.   echo "Docker build error!"
  67. else
  68.   echo "Docker build success!you can run it:

  69. docker run -d -v $src_dir:/opt/greatsql-8.0.32-24 greatsql_build_env"
  70. fi



  71. cat greatsql-automake.sh
  72. #!/bin/bash
  73. MAJOR_VERSION=8
  74. MINOR_VERSION=0
  75. PATCH_VERSION=32
  76. RELEASE=24
  77. REVISION=3714067bc8c
  78. GLIBC=`ldd --version | head -n 1 | awk '{print $NF}'`
  79. ARCH=`uname -p`
  80. #OS=`grep '^ID=' /etc/os-release | sed 's/.*"\(.*\)".*/\1/ig'`
  81. OS=Linux
  82. PKG_NAME=GreatSQL-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${RELEASE}-${OS}-glibc${GLIBC}-${ARCH}
  83. BASE_DIR=/usr/local/${PKG_NAME}
  84. BOOST_VERSION=1_77_0
  85. SOURCE_DIR=greatsql-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${RELEASE}
  86. CMAKE_EXE_LINKER_FLAGS=""
  87. JOBS=`lscpu | grep '^CPU(s)'|awk '{print $NF}'`

  88. if [ ${ARCH} = "x86_64" ] ; then
  89.   CMAKE_EXE_LINKER_FLAGS=" -ljemalloc "
  90. fi

  91. if [ ${ARCH} = "loongarch64" ] ; then
  92.   cd /opt/${SOURCE_DIR}
  93.   sed -i 's/\(.*defined.*mips.*\) \\/\1 defined(__loongarch__) || \\/ig' extra/icu/source/i18n/double-conversion-utils.h
  94. fi

  95. cd /opt/${SOURCE_DIR} && \
  96. rm -fr bld && \
  97. mkdir bld && \
  98. cd bld && \
  99. cmake3 .. -DBOOST_INCLUDE_DIR=/opt/boost_${BOOST_VERSION} \
  100. -DLOCAL_BOOST_DIR=/opt/boost_${BOOST_VERSION} \
  101. -DCMAKE_INSTALL_PREFIX=${BASE_DIR} -DWITH_ZLIB=bundled \
  102. -DWITH_NUMA=ON -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
  103. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release \
  104. -DWITH_TOKUDB=OFF -DWITH_ROCKSDB=OFF \
  105. -DCOMPILATION_COMMENT="${MYSQL} GreatSQL, Release ${RELEASE}, Revision ${REVISION}" \
  106. -DMAJOR_VERSION=${MAJOR_VERSION} -DMINOR_VERSION=${MINOR_VERSION} -DPATCH_VERSION=${PATCH_VERSION} \
  107. -DWITH_NDB=OFF -DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF -DWITH_NDBCLUSTER=OFF \
  108. -DWITH_UNIT_TESTS=OFF -DWITH_SSL=system -DWITH_SYSTEMD=ON \
  109. -DWITH_AUTHENTICATION_LDAP=OFF \
  110. -DWITH_COREDUMPER=ON \
  111. >> /tmp/greatsql-automake.log 2>&1 && make -j${JOBS} >> /tmp/greatsql-automake.log 2>&1 && make -j${JOBS} install >> /tmp/greatsql-automake.log 2>&1

  112. cd /usr/local/
  113. tar -czvf ${BASE_DIR}.tar.gz ${BASE_DIR}
  114. cp ${BASE_DIR}.tar.gz /opt/${SOURCE_DIR}/
复制代码

=========================================
改了下叶总的 文件, 国内环境请添加对应的国内repo,请参考 https://gitee.com/GreatSQL/Great ... kerfile-centos7-x86




全部回复(1)
yejr 2023-8-30 12:17:02
大赞,感谢分享
earl86

8

主题

0

博客

46

贡献

注册会员

Rank: 2

积分
74

助人为乐(铜)

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-11-22 00:01 , Processed in 0.022460 second(s), 18 queries , Redis On.
快速回复 返回顶部 返回列表