forked from tutumcloud/mysql-backup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (43 loc) · 1.9 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
FROM ubuntu:xenial
MAINTAINER Tutum Labs <[email protected]>
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN mkdir -p /var/lib/mysql/ \
&& groupadd -r mysql \
&& useradd -r -g mysql -d /var/lib/mysql/ mysql \
&& chown mysql:mysql /var/lib/mysql \
&& chmod 700 /var/lib/mysql
# add gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y --auto-remove ca-certificates wget
# gpg: key 5072E1F5: public key "MySQL Release Engineering <[email protected]>" imported
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
ENV MYSQL_MAJOR 5.7
ENV MYSQL_VERSION 5.7.17-1ubuntu16.04
RUN echo "deb http://repo.mysql.com/apt/ubuntu/ xenial mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
RUN apt-get update \
&& apt-get install -y \
mysql-client="${MYSQL_VERSION}" \
cron \
openssh-client \
python-paramiko \
python-pexpect \
duplicity \
python \
&& rm -rf /var/lib/apt/lists/*
# timezone
ENV TIMEZONE="Etc/UTC"
ENV CRON_TIME="0 0 * * *" \
MYSQL_DB="--all-databases"
ADD run.sh /run.sh
VOLUME ["/backup"]
CMD ["/run.sh"]