This repository has been archived by the owner on Feb 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathDockerfile-mariadb
64 lines (39 loc) · 2.03 KB
/
Dockerfile-mariadb
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
FROM mariadb:10.1
LABEL maintainer "Nazar Mokrynskyi <[email protected]>"
COPY webserver-common /webserver-common/
RUN \
/webserver-common/create-git-user.sh && \
/webserver-common/apt-get-update.sh && \
/webserver-common/apt-get-install-common.sh && \
/webserver-common/apt-get-install-ceph-fuse.sh && \
/webserver-common/apt-get-cleanup.sh && \
# We'll keep configs in /data/mysql/config on first instance and local directory on others (is set locally in container)
sed -i 's/\/etc\/mysql/\/data\/mysql\/config/g' /etc/mysql/my.cnf && \
# Append Galera cluster config inclusion to default config
echo '!include /data/mysql/config/galera.cfg' >> /etc/mysql/my.cnf && \
# We'll keep data in /data/mysql/data on first instance and local directory on others (is set locally in container)
sed -i 's/\/var\/lib\/mysql/\/data\/mysql\/data/g' /etc/mysql/my.cnf && \
# We'll keep logs in /data/mysql/log on first instance and local directory on others (is set locally in container)
sed -i 's/\/var\/log\/mysql/\/data\/mysql\/log/g' /etc/mysql/my.cnf && \
# This is to redirect logs to stderr instead of non-running syslog (otherwise error messages will be lost)
truncate --size=0 /etc/mysql/conf.d/mysqld_safe_syslog.cnf && \
mv /etc/mysql /etc/mysql_dist && \
# Copy original entrypoint without exec call in order to use it as MariaDB initialization script
sed 's/exec "$@"//g' /usr/local/bin/docker-entrypoint.sh > /docker-entrypoint-init.sh && \
chmod +x /docker-entrypoint-init.sh && \
# Restore original ids of mysql user and group, they will replace existing mysql group from the image, which were changed to custom
userdel mysql && \
addgroup -gid 999 mysql && \
useradd -s /bin/bash -g 999 -u 999 mysql
COPY mariadb/galera.cnf /etc/mysql_dist/galera.cfg
COPY mariadb/webserver-entrypoint.sh /
# /tmp will be used for non-master nodes to store data between restarts and image upgrades
VOLUME \
/data \
/tmp
ENV \
CEPH_MON_SERVICE=ceph-mon \
CEPHFS_MOUNT=0 \
SERVICE_NAME=mariadb
ENTRYPOINT ["/webserver-entrypoint.sh"]
CMD ["mysqld"]