forked from HerrmannHinz/percona5.7-tokudb-dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (61 loc) · 2.77 KB
/
Dockerfile
File metadata and controls
69 lines (61 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM centos:7
LABEL org.opencontainers.image.authors="info@percona.com"
RUN groupadd -g 1001 mysql
RUN useradd -u 1001 -r -g 1001 -s /sbin/nologin \
-c "Default Application User" mysql
# check repository package signature in secure way
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A; \
gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \
rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7; \
\
curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \
rpmkeys --checksig /tmp/percona-release.rpm; \
yum install -y /tmp/percona-release.rpm; \
\
rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \
rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \
\
percona-release disable all; \
percona-release enable original release
# install exact version of PS for repeatability
ENV PERCONA_VERSION 5.6.51-rel91.0.1.el7
RUN set -ex; \
yum install -y \
Percona-Server-server-56-${PERCONA_VERSION} \
Percona-Server-tokudb-56-${PERCONA_VERSION} \
jemalloc \
which \
policycoreutils; \
\
yum clean all; \
rm -rf /var/cache/yum /var/lib/mysql
# purge and re-create /var/lib/mysql with appropriate ownership
RUN /usr/bin/install -m 0775 -o mysql -g root -d /etc/my.cnf.d /var/lib/mysql /var/run/mysqld /docker-entrypoint-initdb.d \
# comment out a few problematic configuration values
&& find /etc/my.cnf /etc/my.cnf.d -name '*.cnf' -print0 \
| xargs -0 grep -lZE '^(bind-address|log|user|sql_mode)' \
| xargs -rt -0 sed -Ei 's/^(bind-address|log|user|sql_mode)/#&/' \
# allow enable TokuDB without root
&& sed -i '/Make sure only root/,/fi/d' /usr/bin/ps_tokudb_admin \
&& echo "thp-setting=never" >> /etc/my.cnf \
# don't reverse lookup hostnames, they are usually another container
&& echo '!includedir /etc/my.cnf.d' >> /etc/my.cnf \
&& printf '[mysqld]\nskip-host-cache\nskip-name-resolve\n' > /etc/my.cnf.d/docker.cnf \
# TokuDB modifications
&& /usr/bin/install -m 0664 -o mysql -g root /dev/null /etc/sysconfig/mysql \
&& echo "LD_PRELOAD=/usr/lib64/libjemalloc.so.1" >> /etc/sysconfig/mysql \
&& echo "THP_SETTING=never" >> /etc/sysconfig/mysql \
# keep backward compatibility with debian images
&& ln -s /etc/my.cnf.d /etc/mysql \
# allow to change config files
&& chown -R mysql:root /etc/my.cnf /etc/my.cnf.d \
&& chown -R mysql:mysql /var/lib/mysql \
&& chmod -R ug+rwX /etc/my.cnf /etc/my.cnf.d
VOLUME ["/var/lib/mysql", "/var/log/mysql"]
COPY ps-entry.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
USER mysql
EXPOSE 3306
CMD ["mysqld"]