-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
47 lines (35 loc) · 1.95 KB
/
Dockerfile
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
# vim:set ft=dockerfile:
FROM debian:jessie
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql
# install "pwgen" for randomizing passwords
RUN apt-get update && apt-get install -y pwgen && rm -rf /var/lib/apt/lists/*
RUN mkdir /docker-entrypoint-initdb.d
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A
RUN echo 'deb http://repo.percona.com/apt jessie main' > /etc/apt/sources.list.d/percona.list
ENV PERCONA_MAJOR 5.6
ENV PERCONA_VERSION 5.6.28-76.1-1.jessie
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
# also, we set debconf keys to make APT a little quieter
RUN { \
echo percona-server-server-$PERCONA_MAJOR percona-server-server/root_password password 'unused'; \
echo percona-server-server-$PERCONA_MAJOR percona-server-server/root_password_again password 'unused'; \
} | debconf-set-selections \
&& apt-get update \
&& apt-get install -y \
percona-server-server-$PERCONA_MAJOR=$PERCONA_VERSION percona-toolkit percona-xtrabackup wget \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mysql \
&& mkdir /var/lib/mysql
# comment out a few problematic configuration values
# don't reverse lookup hostnames, they are usually another container
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
&& echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
&& mv /tmp/my.cnf /etc/mysql/my.cnf
VOLUME ["/var/lib/mysql", "/var/log/mysql"]
#COPY docker-entrypoint.sh /
COPY restore-percona-backup /usr/bin/
COPY restore-backup.sh /
ENTRYPOINT ["/restore-backup.sh"]
EXPOSE 3306
#CMD ["/restore-backup.sh"]