1
1
# vim:set ft=dockerfile:
2
- FROM debian:jessie
2
+ FROM ubuntu:xenial
3
3
4
4
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
5
5
RUN groupadd -r mysql && useradd -r -g mysql mysql
6
6
7
+ # https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg)
8
+ RUN set -ex; \
9
+ apt-get update; \
10
+ if ! which gpg; then \
11
+ apt-get install -y --no-install-recommends gnupg; \
12
+ fi; \
13
+ # Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr
14
+ # so, if we're not running gnupg 1.x, explicitly install dirmngr too
15
+ if ! gpg --version | grep -q '^gpg (GnuPG) 1\. ' ; then \
16
+ apt-get install -y --no-install-recommends dirmngr; \
17
+ fi; \
18
+ rm -rf /var/lib/apt/lists/*
19
+
7
20
# add gosu for easy step-down from root
8
21
ENV GOSU_VERSION 1.10
9
22
RUN set -ex; \
@@ -24,6 +37,7 @@ RUN set -ex; \
24
37
export GNUPGHOME="$(mktemp -d)" ; \
25
38
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
26
39
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
40
+ command -v gpgconf > /dev/null && gpgconf --kill all || :; \
27
41
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
28
42
\
29
43
chmod +x /usr/local/bin/gosu; \
@@ -34,17 +48,26 @@ RUN set -ex; \
34
48
35
49
RUN mkdir /docker-entrypoint-initdb.d
36
50
37
- # install "pwgen" for randomizing passwords
38
51
# install "apt-transport-https" for Percona's repo (switched to https-only)
52
+ # install "pwgen" for randomizing passwords
53
+ # install "tzdata" for /usr/share/zoneinfo/
39
54
RUN apt-get update && apt-get install -y --no-install-recommends \
40
55
apt-transport-https ca-certificates \
41
56
pwgen \
57
+ tzdata \
42
58
&& rm -rf /var/lib/apt/lists/*
43
59
44
60
ENV GPG_KEYS \
45
61
# Key fingerprint = 1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
46
62
# MariaDB Package Signing Key <[email protected] >
63
+ # for MariaDB 5.5
47
64
199369E5404BD5FC7D2FE43BCBCB082A1BB943DB \
65
+ # pub rsa4096 2016-03-30 [SC]
66
+ # 177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8
67
+ # uid [ unknown] MariaDB Signing Key <[email protected] >
68
+ # sub rsa4096 2016-03-30 [E]
69
+ # for MariaDB 10+
70
+ 177F4010FE56CA3336300305F1656F24C74CD1D8 \
48
71
# pub 1024D/CD2EFD2A 2009-12-15
49
72
# Key fingerprint = 430B DF5C 56E7 C94E 848E E60C 1C4C BDCD CD2E FD2A
50
73
# uid Percona MySQL Development Team <[email protected] >
@@ -61,22 +84,17 @@ RUN set -ex; \
61
84
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
62
85
done; \
63
86
gpg --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mariadb.gpg; \
87
+ command -v gpgconf > /dev/null && gpgconf --kill all || :; \
64
88
rm -r "$GNUPGHOME" ; \
65
89
apt-key list
66
90
67
- # add Percona's repo for xtrabackup (which is useful for Galera)
68
- RUN echo "deb https://repo.percona.com/apt jessie main" > /etc/apt/sources.list.d/percona.list \
69
- && { \
70
- echo 'Package: *' ; \
71
- echo 'Pin: release o=Percona Development Team' ; \
72
- echo 'Pin-Priority: 998' ; \
73
- } > /etc/apt/preferences.d/percona
74
-
91
+ # bashbrew-architectures: amd64 arm64v8 i386 ppc64le
75
92
ENV MARIADB_MAJOR 10.0
76
- ENV MARIADB_VERSION 10.0.35+maria-1~jessie
93
+ ENV MARIADB_VERSION 10.0.35+maria-1~xenial
77
94
78
- RUN echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/debian jessie main" > /etc/apt/sources.list.d/mariadb.list \
79
- && { \
95
+ RUN set -e;\
96
+ echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/ubuntu xenial main" > /etc/apt/sources.list.d/mariadb.list; \
97
+ { \
80
98
echo 'Package: *' ; \
81
99
echo 'Pin: release o=MariaDB' ; \
82
100
echo 'Pin-Priority: 999' ; \
@@ -86,30 +104,51 @@ RUN echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/debian jessi
86
104
87
105
# 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)
88
106
# also, we set debconf keys to make APT a little quieter
89
- RUN { \
107
+ RUN set -ex; \
108
+ { \
90
109
echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password password 'unused' ; \
91
110
echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password_again password 'unused' ; \
92
- } | debconf-set-selections \
93
- && apt-get update \
94
- && apt-get install -y \
111
+ } | debconf-set-selections; \
112
+ backupPackage='percona-xtrabackup' ; \
113
+ # #<autogenerated> from Dockerfile-percona-block ##
114
+ # add Percona's repo for xtrabackup (which is useful for Galera)
115
+ echo "deb [arch=amd64,i386] https://repo.percona.com/apt xenial main" > /etc/apt/sources.list.d/percona.list; \
116
+ { \
117
+ echo 'Package: *' ; \
118
+ echo 'Pin: release o=Percona Development Team' ; \
119
+ echo 'Pin-Priority: 998' ; \
120
+ } > /etc/apt/preferences.d/percona; \
121
+ # percona-xtrabackup is amd64/i386 only (mariadb-backup is on all arches that mariadb-server is)
122
+ dpkgArch="$(dpkg --print-architecture)" ; \
123
+ if [[ "$backupPackage" == percona* ]]; then \
124
+ case "${dpkgArch##*-}" in \
125
+ amd64|i396) ;; \
126
+ *) backupPackage= ;; \
127
+ esac; \
128
+ fi; \
129
+ # #</autogenerated>##
130
+ apt-get update; \
131
+ apt-get install -y \
95
132
"mariadb-server=$MARIADB_VERSION" \
96
- # percona-xtrabackup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos
97
- percona-xtrabackup \
133
+ # percona-xtrabackup/mariadb-backup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos
134
+ $backupPackage \
98
135
socat \
99
- && rm -rf /var/lib/apt/lists/* \
136
+ ; \
137
+ rm -rf /var/lib/apt/lists/*; \
100
138
# comment out any "user" entires in the MySQL config ("docker-entrypoint.sh" or "--user" will handle user switching)
101
- && sed -ri 's/^user\s /#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/* \
139
+ sed -ri 's/^user\s /#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/*; \
102
140
# purge and re-create /var/lib/mysql with appropriate ownership
103
- && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
104
- && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
141
+ rm -rf /var/lib/mysql; \
142
+ mkdir -p /var/lib/mysql /var/run/mysqld; \
143
+ chown -R mysql:mysql /var/lib/mysql /var/run/mysqld; \
105
144
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
106
- && chmod 777 /var/run/mysqld \
145
+ chmod 777 /var/run/mysqld; \
107
146
# comment out a few problematic configuration values
108
- && find /etc/mysql/ -name '*.cnf' -print0 \
147
+ find /etc/mysql/ -name '*.cnf' -print0 \
109
148
| xargs -0 grep -lZE '^(bind-address|log)' \
110
- | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
149
+ | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' ; \
111
150
# don't reverse lookup hostnames, they are usually another container
112
- && echo '[mysqld]\n skip-host-cache\n skip-name-resolve' > /etc/mysql/conf.d/docker.cnf
151
+ echo '[mysqld]\n skip-host-cache\n skip-name-resolve' > /etc/mysql/conf.d/docker.cnf
113
152
114
153
VOLUME /var/lib/mysql
115
154
0 commit comments