11# vim:set ft=dockerfile:
2- FROM debian:jessie
2+ FROM ubuntu:xenial
33
44# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55RUN groupadd -r mysql && useradd -r -g mysql mysql
66
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+
720# add gosu for easy step-down from root
821ENV GOSU_VERSION 1.10
922RUN set -ex; \
@@ -24,6 +37,7 @@ RUN set -ex; \
2437 export GNUPGHOME="$(mktemp -d)" ; \
2538 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
2639 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
40+ command -v gpgconf > /dev/null && gpgconf --kill all || :; \
2741 rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
2842 \
2943 chmod +x /usr/local/bin/gosu; \
@@ -34,17 +48,26 @@ RUN set -ex; \
3448
3549RUN mkdir /docker-entrypoint-initdb.d
3650
37- # install "pwgen" for randomizing passwords
3851# 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/
3954RUN apt-get update && apt-get install -y --no-install-recommends \
4055 apt-transport-https ca-certificates \
4156 pwgen \
57+ tzdata \
4258 && rm -rf /var/lib/apt/lists/*
4359
4460ENV GPG_KEYS \
4561# Key fingerprint = 1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
4662# MariaDB Package Signing Key <[email protected] >63+ # for MariaDB 5.5
4764 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 \
4871# pub 1024D/CD2EFD2A 2009-12-15
4972# Key fingerprint = 430B DF5C 56E7 C94E 848E E60C 1C4C BDCD CD2E FD2A
5073# uid Percona MySQL Development Team <[email protected] >@@ -61,22 +84,17 @@ RUN set -ex; \
6184 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
6285 done; \
6386 gpg --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mariadb.gpg; \
87+ command -v gpgconf > /dev/null && gpgconf --kill all || :; \
6488 rm -r "$GNUPGHOME" ; \
6589 apt-key list
6690
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
7592ENV MARIADB_MAJOR 10.0
76- ENV MARIADB_VERSION 10.0.35+maria-1~jessie
93+ ENV MARIADB_VERSION 10.0.35+maria-1~xenial
7794
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+ { \
8098 echo 'Package: *' ; \
8199 echo 'Pin: release o=MariaDB' ; \
82100 echo 'Pin-Priority: 999' ; \
@@ -86,30 +104,51 @@ RUN echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/debian jessi
86104
87105# 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)
88106# also, we set debconf keys to make APT a little quieter
89- RUN { \
107+ RUN set -ex; \
108+ { \
90109 echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password password 'unused' ; \
91110 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 \
95132 "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 \
98135 socat \
99- && rm -rf /var/lib/apt/lists/* \
136+ ; \
137+ rm -rf /var/lib/apt/lists/*; \
100138# 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/*; \
102140# 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; \
105144# 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; \
107146# comment out a few problematic configuration values
108- && find /etc/mysql/ -name '*.cnf' -print0 \
147+ find /etc/mysql/ -name '*.cnf' -print0 \
109148 | 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)/#&/' ; \
111150# 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
113152
114153VOLUME /var/lib/mysql
115154
0 commit comments