centos7构建 greatsql-8.0.32-24 docker编译环境
cat DockerfileFROM centos:7
ENV LANG en_US.utf8
#ENV PATH="/usr/local/mysql/bin:${PATH}"
#ENV LD_LIBRARY_PATH="/usr/local/mysql/lib:${LD_LIBRARY_PATH}"
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum install -y epel-release
#RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
RUN yum clean all && \
yum makecache
RUN yum install -y --skip-broken yum-utils wget unzip tar vim file time rpm* git diffutils net-tools \
gcc gcc-c++ clang ccache libtool psmisc flex valgrind \
automake make cmake cmake3 pkg-config rpcgen \
openssl openssl-devel libssh libssl \
cyrus-sasl-devel cyrus-sasl-scram \
pam pam-devel \
openldap-devel openldap-clients \
readline-devel expat-devel re2-devel \
bison bison-devel \
libaio-devel libevent-devel libicu-devel libffi-devel \
libxml2-devel \
libtirpc libtirpc-devel \
libarchive libcurl-devel \
ncurses-devel ncurses-libs \
boost-devel \
numactl numactl-devel numactl-libs \
gflags-devel gtest-devel \
libzstd libzstd-devel libzstd-static \
patchelf \
perl perl-Env perl-JSON perl-Memoize perl-Time-HiRes \
bzip2 bzip2-devel snappy-devel zlib-devel lz4-devel lz4-static \
jemalloc jemalloc-devel \
python-devel \
redhat-lsb-core centos-release-scl scl-utils-build
RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
RUN scl enable devtoolset-11 bash
RUN echo 'scl enable devtoolset-11 bash' >> /root/.bash_profile
# update patchelf 0.13
COPY patchelf-0.13.tar.gz /tmp/
RUN cd /tmp && tar -xzvf patchelf-0.13.tar.gz && cd patchelf-0.13 && ./bootstrap.sh && ./configure && make && make install
COPY rpcsvc-proto-1.4.tar.gz /tmp/rpcsvc-proto-1.4.tar.gz
RUN tar zxvf /tmp/rpcsvc-proto-1.4.tar.gz -C /tmp && cd /tmp/rpcsvc-proto-1.4/ && ./configure && make && make install
RUN rm -fr /tmp/*
#download boost-1.77 from https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz
COPY boost_1_77_0.tar.gz /opt/
COPY greatsql-automake.sh /opt/
CMD ["/usr/sbin/init"]
cat greatsql-docker-build.sh
#!/bin/bash
##
## 自动构建GreatSQL Docker编译环境
##
## 文档:https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/user-manual/4-install-guide/4-6-install-with-source-code.md
##
docker build -t greatsql_build_env .
src_dir=$1
if [ $? -ne 0 ];then
echo "Docker build error!"
else
echo "Docker build success!you can run it:
docker run -d -v $src_dir:/opt/greatsql-8.0.32-24 greatsql_build_env"
fi
cat greatsql-automake.sh
#!/bin/bash
MAJOR_VERSION=8
MINOR_VERSION=0
PATCH_VERSION=32
RELEASE=24
REVISION=3714067bc8c
GLIBC=`ldd --version | head -n 1 | awk '{print $NF}'`
ARCH=`uname -p`
#OS=`grep '^ID=' /etc/os-release | sed 's/.*"\(.*\)".*/\1/ig'`
OS=Linux
PKG_NAME=GreatSQL-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${RELEASE}-${OS}-glibc${GLIBC}-${ARCH}
BASE_DIR=/usr/local/${PKG_NAME}
BOOST_VERSION=1_77_0
SOURCE_DIR=greatsql-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-${RELEASE}
CMAKE_EXE_LINKER_FLAGS=""
JOBS=`lscpu | grep '^CPU(s)'|awk '{print $NF}'`
if [ ${ARCH} = "x86_64" ] ; then
CMAKE_EXE_LINKER_FLAGS=" -ljemalloc "
fi
if [ ${ARCH} = "loongarch64" ] ; then
cd /opt/${SOURCE_DIR}
sed -i 's/\(.*defined.*mips.*\) \\/\1 defined(__loongarch__) || \\/ig' extra/icu/source/i18n/double-conversion-utils.h
fi
cd /opt/${SOURCE_DIR} && \
rm -fr bld && \
mkdir bld && \
cd bld && \
cmake3 .. -DBOOST_INCLUDE_DIR=/opt/boost_${BOOST_VERSION} \
-DLOCAL_BOOST_DIR=/opt/boost_${BOOST_VERSION} \
-DCMAKE_INSTALL_PREFIX=${BASE_DIR} -DWITH_ZLIB=bundled \
-DWITH_NUMA=ON -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release \
-DWITH_TOKUDB=OFF -DWITH_ROCKSDB=OFF \
-DCOMPILATION_COMMENT="${MYSQL} GreatSQL, Release ${RELEASE}, Revision ${REVISION}" \
-DMAJOR_VERSION=${MAJOR_VERSION} -DMINOR_VERSION=${MINOR_VERSION} -DPATCH_VERSION=${PATCH_VERSION} \
-DWITH_NDB=OFF -DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF -DWITH_NDBCLUSTER=OFF \
-DWITH_UNIT_TESTS=OFF -DWITH_SSL=system -DWITH_SYSTEMD=ON \
-DWITH_AUTHENTICATION_LDAP=OFF \
-DWITH_COREDUMPER=ON \
>> /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
cd /usr/local/
tar -czvf ${BASE_DIR}.tar.gz ${BASE_DIR}
cp ${BASE_DIR}.tar.gz /opt/${SOURCE_DIR}/
=========================================
改了下叶总的 文件, 国内环境请添加对应的国内repo,请参考 https://gitee.com/GreatSQL/Great ... kerfile-centos7-x86
大赞,感谢分享
页:
[1]