Skip to content

Commit

Permalink
变更dockerfile-base
Browse files Browse the repository at this point in the history
  • Loading branch information
peng19832 authored and LeoQuote committed Jan 17, 2023
1 parent 4fdf73c commit 8aab2e4
Showing 1 changed file with 56 additions and 43 deletions.
99 changes: 56 additions & 43 deletions src/docker/Dockerfile-base
Original file line number Diff line number Diff line change
@@ -1,47 +1,29 @@
FROM docker.io/centos:7
FROM centos:7 AS compbasedeps

ENV PYTHON_VERSION 3.9.10
ENV DOCKERIZE_VERSION v0.6.1
ENV SOAR_VERSION 0.11.0

ENV TZ=Asia/Shanghai

WORKDIR /opt

#locale
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& yum -y install kde-l10n-Chinese \
&& yum -y install glibc-common \
&& localedef -c -f UTF-8 -i zh_CN zh_CN.utf8

ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8


#python
RUN yum -y install libffi-devel wget gcc make zlib-devel openssl openssl-devel ncurses-devel openldap-devel gettext bzip2-devel xz-devel \
RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' -i /etc/yum.repos.d/CentOS-*.repo \
&& yum install -y epel-release \
&& sed -e 's!^metalink=!#metalink=!g' -e 's!^#baseurl=!baseurl=!g' -e 's!//download\.fedoraproject\.org/pub!//mirrors.tuna.tsinghua.edu.cn!g' -e 's!//download\.example/pub!//mirrors.tuna.tsinghua.edu.cn!g' -e 's!http://mirrors!https://mirrors!g' -i /etc/yum.repos.d/epel*.repo \
&& yum -y install cmake glibc-common bison gcc-c++ git mysql-devel libaio-devel glib2 glib2-devel libffi-devel gcc make zlib-devel openssl openssl-devel ncurses-devel openldap-devel gettext bzip2-devel xz-devel wget \
#python 3
&& cd /opt \
&& wget "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
&& tar -xvJf Python-$PYTHON_VERSION.tar.xz \
&& cd /opt/Python-$PYTHON_VERSION \
&& ./configure prefix=/usr/local/python3 \
&& make && make install \
&& ln -fs /usr/local/python3/bin/python3 /usr/bin/python3 \
&& ln -fs /usr/local/python3/bin/pip3 /usr/bin/pip3 \
&& pip3 install virtualenv \
&& cd /opt \
&& ln -fs /usr/local/python3/bin/virtualenv /usr/bin/virtualenv \
&& virtualenv venv4archery --python=python3 \
&& rm -rf Python-$PYTHON_VERSION \
&& rm -rf Python-$PYTHON_VERSION.tar.xz \
&& /usr/local/python3/bin/pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv \
#dockerize
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /opt -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
#sqladvisor
&& yum -y install epel-release \
&& yum -y install cmake bison gcc-c++ git mysql-devel libaio-devel glib2 glib2-devel \
&& yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm \
&& yum -y install https://mirrors.ustc.edu.cn/percona/percona/yum/percona-release-latest.noarch.rpm \
&& sed -e 's|http://repo.percona.com/|https://mirrors.ustc.edu.cn/percona/|g' -i /etc/yum.repos.d/percona-*.repo \
&& yum -y install Percona-Server-devel-57 Percona-Server-shared-57 Percona-Server-client-57 \
&& yum -y install percona-toolkit \
&& ln -fs /usr/lib64/mysql/libmysqlclient.so.18 /usr/lib64/libperconaserverclient_r.so \
Expand All @@ -53,26 +35,57 @@ RUN yum -y install libffi-devel wget gcc make zlib-devel openssl openssl-devel n
&& cd sqladvisor/ \
&& cmake -DCMAKE_BUILD_TYPE=debug ./ \
&& make \
&& mv /opt/SQLAdvisor/sqladvisor/sqladvisor /opt \
&& rm -rf /opt/SQLAdvisor/
#soar
RUN cd /opt \
&& cd /opt \
&& wget https://github.com/XiaoMi/soar/releases/download/$SOAR_VERSION/soar.linux-amd64 -O soar \
&& chmod a+x soar \
#my2sql
&& cd /opt \
&& wget https://raw.githubusercontent.com/liuhr/my2sql/master/releases/centOS_release_7.x/my2sql -O my2sql \
&& chmod a+x my2sql \
#mongo
&& wget -c https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.20.tgz \
&& tar -xvf mongodb-linux-x86_64-rhel70-3.6.20.tgz

FROM centos:7

ENV TZ=Asia/Shanghai

WORKDIR /opt

COPY --from=compbasedeps /etc/yum.repos.d/percona-*.repo /opt/
COPY --from=compbasedeps /etc/pki/rpm-gpg/PERCONA-* /opt/
COPY --from=compbasedeps /etc/yum.repos.d/epel*.repo /etc/yum.repos.d/
COPY --from=compbasedeps /opt/SQLAdvisor/sqladvisor/sqladvisor /opt/
COPY --from=compbasedeps /opt/soar /opt/
COPY --from=compbasedeps /opt/my2sql /opt/
COPY --from=compbasedeps /opt/dockerize /usr/local/bin/
COPY --from=compbasedeps /opt/mongodb-linux-x86_64-rhel70-3.6.20/bin/mongo /usr/local/bin/
COPY --from=compbasedeps /usr/local/python3 /usr/local/python3
COPY --from=compbasedeps /usr/local/sqlparser /usr/local/sqlparser

RUN cd /opt \
&& sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' -i /etc/yum.repos.d/CentOS-*.repo \
&& yum -y install vim kde-l10n-Chinese glibc-common libcurl cyrus-sasl-gssapi cyrus-sasl-plain cmake bison gcc-c++ mysql-devel libaio-devel glib2 glib2-devel xz-compat-libs libffi-devel gcc make zlib-devel openssl openssl-devel ncurses-devel openldap-devel gettext bzip2-devel xz-devel wget \
#msodbc
&& cd /opt \
&& curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo \
&& ACCEPT_EULA=Y yum -y install msodbcsql17 \
&& yum -y install unixODBC-devel \
#oracle
&& ACCEPT_EULA=Y yum -y install msodbcsql17 unixODBC-devel \
#oracle client
&& yum -y install http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.3-basiclite-19.3.0.0.0-1.x86_64.rpm \
#mongo
&& wget -c https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.20.tgz \
&& tar -xvf mongodb-linux-x86_64-rhel70-3.6.20.tgz \
&& cp mongodb-linux-x86_64-rhel70-3.6.20/bin/mongo /usr/local/bin/mongo \
&& rm -rf mongodb-linux-x86_64-*
&& mv /opt/percona-*.repo /etc/yum.repos.d/ \
&& mv /opt/PERCONA-* /etc/pki/rpm-gpg/ \
&& yum -y install Percona-Server-devel-57 Percona-Server-shared-57 Percona-Server-client-57 percona-toolkit \
&& yum clean all \
&& rm -rf /var/cache/yum/* \
&& ln -fs /usr/lib64/mysql/libmysqlclient.so.18 /usr/lib64/libperconaserverclient_r.so \
&& ln -fs /usr/lib64/liblzma.so.0 /usr/lib64/liblzma.so \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 \
&& cd /opt \
&& chmod +x sqladvisor soar my2sql \
&& chmod +x /usr/local/bin/dockerize \
&& chmod +x /usr/local/bin/mongo \
&& ln -fs /usr/local/python3/bin/python3 /usr/bin/python3 \
&& ln -fs /usr/local/python3/bin/pip3 /usr/bin/pip3 \
&& ln -fs /usr/local/python3/bin/virtualenv /usr/bin/virtualenv \
&& virtualenv venv4archery --python=python3

ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8

0 comments on commit 8aab2e4

Please sign in to comment.