105 lines
3.8 KiB
Plaintext
105 lines
3.8 KiB
Plaintext
ARG ARCH
|
|
FROM harbor.colben.cn/general/rocky$ARCH:8
|
|
MAINTAINER Colben colbenlee@gmail.com
|
|
ARG BUNDLE_FILE
|
|
ADD --chown=root:root /ADD/ /opt/
|
|
RUN echo -e 'fs.file-max = 1000000\n\
|
|
net.core.somaxconn = 32768\n\
|
|
net.ipv4.tcp_syncookies = 0\n\
|
|
vm.overcommit_memory = 1\n\
|
|
' >> /etc/sysctl.conf \
|
|
&& echo -e '\n\
|
|
mysql soft nofile 65535\n\
|
|
mysql hard nofile 65535\n\
|
|
mysql soft stack 32768\n\
|
|
mysql hard stack 32768\n\
|
|
mysql soft nproc 65535\n\
|
|
mysql hard nproc 65535\n\
|
|
' >> /etc/security/limits.conf \
|
|
&& echo -e '[epel]\n\
|
|
name=Extra Packages for Enterprise Linux $releasever - $basearch\n\
|
|
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch\n\
|
|
enabled=1\n\
|
|
gpgcheck=0\n\
|
|
' > /etc/yum.repos.d/epel.repo \
|
|
&& dnf makecache \
|
|
&& dnf -y install xz pkg-config perl libaio-devel numactl-devel numactl-libs net-tools openssl openssl-devel jemalloc jemalloc-devel perl-Data-Dumper perl-Digest-MD5 python2 perl-JSON perl-Test-Simple \
|
|
&& curl -LO http://10.11.0.1:10080/$BUNDLE_FILE \
|
|
&& tar xf $BUNDLE_FILE -C /tmp/ \
|
|
&& rm -f /tmp/greatsql-devel* /tmp/greatsql-mysql-router-* \
|
|
&& rpm -ivh /tmp/greatsql-*.rpm \
|
|
&& ln -s /usr/bin/mysql /usr/bin/greatsql \
|
|
&& ln -s /usr/sbin/mysqld /usr/sbin/greatsqld \
|
|
&& ln -s /usr/bin/mysqldump /usr/bin/greatsqldump \
|
|
&& ln -s /usr/bin/mysqladmin /usr/bin/greatsqladmin \
|
|
&& rm -rf /usr/sbin/mysqld-debug \
|
|
/var/cache/dnf \
|
|
/var/lib/dnf \
|
|
/var/log/* \
|
|
/etc/my.cnf.d \
|
|
$BUNDLE_FILE \
|
|
/tmp/greatsql-*.rpm \
|
|
&& mkdir -p /var/log/mysql \
|
|
/var/lib/mysql-bin \
|
|
/etc/mysql \
|
|
&& chown -R mysql:mysql \
|
|
/var/log/mysql \
|
|
/var/lib/mysql-bin \
|
|
&& chmod 0750 /var/log/mysql \
|
|
&& sed -i -e 's,--initialize,&-insecure,g' \
|
|
-e 's,/usr/sbin/mysqld ,&--defaults-file=/etc/mysql/my.cnf ,g' \
|
|
/usr/bin/mysqld_pre_systemd \
|
|
&& echo -e '[mysqld]\n\
|
|
mysqlx = OFF\n#\
|
|
default-time-zone = "+8:00"\n\
|
|
lock-wait-timeout = 3600\n\
|
|
open-files-limit = 65535\n\
|
|
back-log = 1024\n\
|
|
max-connections = 512\n\
|
|
max-connect-errors = 1000000\n\
|
|
table-open-cache = 1024\n\
|
|
table-definition-cache = 1024\n\
|
|
thread-stack = 512K\n\
|
|
sort-buffer-size = 4M\n\
|
|
join-buffer-size = 4M\n\
|
|
read-buffer-size = 8M\n\
|
|
read-rnd-buffer-size = 4M\n\
|
|
bulk-insert-buffer-size = 64M\n\
|
|
thread-cache-size = 768\n\
|
|
interactive-timeout = 600\n\
|
|
wait-timeout = 600\n\
|
|
tmp-table-size = 32M\n\
|
|
max-heap-table-size = 32M\n\
|
|
max-allowed-packet = 64M\n\
|
|
net-buffer-shrink-interval = 180\n\
|
|
sql-generate-invisible-primary-key = ON\n\
|
|
' > /etc/my.cnf \
|
|
&& echo -e '[client]\n\
|
|
socket = /run/mysqld/mysqld.sock\n\
|
|
\n\
|
|
[mysql]\n\
|
|
prompt = "[GreatSQL:\u@\d]>\_"\n\
|
|
\n\
|
|
[mysqld]\n\
|
|
user = mysql\n\
|
|
datadir = /var/lib/mysql\n\
|
|
socket = /run/mysqld/mysqld.sock\n\
|
|
pid-file = /run/mysqld/mysqld.pid\n\
|
|
log-timestamps = SYSTEM\n\
|
|
secure-log-path = /var/log/mysql\n\
|
|
log-error = /var/log/mysql/error.log\n\
|
|
log-error-suppression-list = MY-013360\n\
|
|
character-set-server = utf8mb4\n\
|
|
default-storage-engine = innodb\n\
|
|
slow-query-log = TRUE\n\
|
|
slow-query-log-file = /var/log/mysql/slow.log\n\
|
|
authentication-policy = mysql_native_password\n\
|
|
lower-case-table-names = 1\n\
|
|
\n\
|
|
[mysqladmin]\n\
|
|
user = docker\n\
|
|
password = China_19$(10)!\n\
|
|
' > /etc/mysql/my.cnf
|
|
CMD ["/opt/ccmd"]
|
|
|