-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
34 lines (28 loc) · 1.14 KB
/
Dockerfile.template
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
# !include frombase
# !include tini
ARG NEED_USER='mysql'
# !include security
# App-specific config
RUN set -x \
&& echo 'mysql-server mysql-server/root_password password unused' | debconf-set-selections \
&& echo 'mysql-server mysql-server/root_password_again password unused' | debconf-set-selections \
&& apt-get -y update \
&& apt-get -y --no-install-recommends install mysql-server \
&& apt-clean --aggressive \
&& for i in /var/lib/mysql /var/run/mysqld; do \
rm -rf "$i"; \
mkdir -p "$i"; \
chown -R mysql:mysql "$i"; \
done \
&& rm -f /etc/mysql/debian.cnf \
&& sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/* /etc/mysql/mysql.conf.d/* \
&& sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/* /etc/mysql/mysql.conf.d/* \
&& echo '[mysqld]' >> /etc/mysql/conf.d/mysqld-docker.cnf \
&& echo 'skip-host-cache' >> /etc/mysql/conf.d/mysqld-docker.cnf \
&& echo 'skip-name-resolve' >> /etc/mysql/conf.d/mysqld-docker.cnf
USER mysql
VOLUME /var/lib/mysql
COPY entrypoint /entrypoint
ENTRYPOINT ["/tini", "--", "/entrypoint"]
EXPOSE 3306
CMD ["mysqld"]