forked from autopilotpattern/mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (65 loc) · 2.75 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM percona:5.6
ENV CONTAINERPILOT_VER 2.6.0
ENV CONTAINERPILOT file:///etc/containerpilot.json
# By keeping a lot of discrete steps in a single RUN we can clean up after
# ourselves in the same layer. This is gross but it saves ~100MB in the image
RUN set -ex \
&& export buildDeps='python-dev gcc unzip' \
&& export runDeps='python curl libffi-dev libssl-dev percona-xtrabackup ca-certificates' \
&& apt-get update \
&& apt-get install -y $buildDeps $runDeps --no-install-recommends \
# \
# get Python drivers MySQL, Consul, and Manta \
# \
&& curl -Lvo /tmp/mysql-connector.deb http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python_2.1.3-1debian8.2_all.deb \
&& dpkg -i /tmp/mysql-connector.deb \
&& curl -v -Lo /tmp/mysql-utils.deb http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-utilities_1.5.6-1debian8_all.deb \
&& dpkg -i /tmp/mysql-utils.deb \
&& curl -Lvo get-pip.py https://bootstrap.pypa.io/get-pip.py \
&& python get-pip.py \
&& pip install \
python-Consul==0.4.7 \
manta==2.5.0 \
mock==2.0.0 \
# \
# Add Consul from https://releases.hashicorp.com/consul \
# \
&& export CHECKSUM=5dbfc555352bded8a39c7a8bf28b5d7cf47dec493bc0496e21603c84dfe41b4b \
&& curl -Lvo /tmp/consul.zip https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_linux_amd64.zip \
&& echo "${CHECKSUM} /tmp/consul.zip" | sha256sum -c \
&& unzip /tmp/consul.zip -d /usr/local/bin \
&& rm /tmp/consul.zip \
&& mkdir /config \
# \
# Add ContainerPilot and set its configuration file path \
# \
&& export CONTAINERPILOT_CHECKSUM=c1bcd137fadd26ca2998eec192d04c08f62beb1f \
&& curl -Lvo /tmp/containerpilot.tar.gz "https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VER}/containerpilot-${CONTAINERPILOT_VER}.tar.gz" \
&& echo "${CONTAINERPILOT_CHECKSUM} /tmp/containerpilot.tar.gz" | sha1sum -c \
&& tar zxf /tmp/containerpilot.tar.gz -C /usr/local/bin \
&& rm /tmp/containerpilot.tar.gz \
# \
# clean up to minimize image layer size \
# \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm /tmp/mysql-connector.deb \
&& rm /tmp/mysql-utils.deb \
&& rm /get-pip.py \
&& rm /docker-entrypoint.sh
# configure ContainerPilot and MySQL
COPY etc/* /etc/
COPY bin/manager /usr/local/bin/manager
COPY bin/test.py /usr/local/bin/test.py
COPY bin/manage.py /usr/local/bin/manage.py
# override the parent entrypoint
ENTRYPOINT []
# use --console to get error logs to stderr
CMD [ "containerpilot", \
"mysqld", \
"--console", \
"--log-bin=mysql-bin", \
"--log_slave_updates=ON", \
"--gtid-mode=ON", \
"--enforce-gtid-consistency=ON" \
]