blob: 73b1d05beaa7c5f4dbb8b4c924359fbc96a76d2d (
plain)
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
|
# vim:set ft=dockerfile:
FROM alpine:latest
RUN \
addgroup -S mysql \
&& adduser -S -h /var/lib/mysql -H -D -G mysql mysql \
&& mkdir /docker-entrypoint-initdb.d \
&& apk --no-cache add \
bash \
mariadb \
mariadb-client \
pwgen \
socat \
su-exec \
tzdata \
# comment out any "user" entires in the MySQL config
# ("docker-entrypoint.sh" or "--user" will handle user switching)
&& sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf \
# increase innodb buffer pool size
&& sed -i 's/^#innodb_buffer_pool_size = 16M/innodb_buffer_pool_size = 30M/' /etc/mysql/my.cnf \
# purge and re-create /var/lib/mysql with appropriate ownership
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /run/mysqld \
&& chown -R mysql:mysql /var/lib/mysql /run/mysqld \
# ensure that /run/mysqld (used for socket and lock files) is writable
# regardless of the UID our mysqld instance ends up having at runtime
&& chmod 777 /run/mysqld \
# don't reverse lookup hostnames, they are usually another container
&& sed -i 's/\[mysqld\]/[mysqld]\nskip-host-cache/' /etc/mysql/my.cnf
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["mysqld"]
|