Skip to content

Commit 61d3f34

Browse files
authored
Merge pull request #184 from infosiftr/more-arches-also-ubuntu
More arches (ppc64le + arm64v8) and ubuntu
2 parents 8818681 + 195c843 commit 61d3f34

11 files changed

+451
-176
lines changed

.architectures-lib

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
hasBashbrewArch() {
4+
local version="$1"; shift
5+
local bashbrewArch="$1"; shift
6+
local arches="$(grep 'bashbrew-architectures:' "$version/Dockerfile" | cut -d':' -f2)"
7+
[[ " $arches " == *" $bashbrewArch "* ]]
8+
}
9+
10+
_generateParentRepoToArches() {
11+
local repo="$1"; shift
12+
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
13+
14+
eval "declare -g -A parentRepoToArches=( $(
15+
find -name 'Dockerfile' -exec awk '
16+
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
17+
print "'"$officialImagesUrl"'" $2
18+
}
19+
' '{}' + \
20+
| sort -u \
21+
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
22+
) )"
23+
}
24+
_generateParentRepoToArches 'mariadb'
25+
26+
parentArches() {
27+
local version="$1"; shift # "1.8", etc
28+
29+
local parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
30+
echo "${parentRepoToArches[$parent]:-}"
31+
}
32+
versionArches() {
33+
local version="$1"; shift # "1.8", etc
34+
35+
local parentArches="$(parentArches "$version")"
36+
37+
local variantArches=()
38+
for arch in $parentArches; do
39+
if hasBashbrewArch "$version" "$arch"; then
40+
variantArches+=( "$arch" )
41+
fi
42+
done
43+
echo "${variantArches[*]}"
44+
}

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ install:
1313

1414
before_script:
1515
- env | sort
16+
- wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash
1617
- cd "$VERSION"
1718
- image="mariadb:$VERSION"
1819

1920
script:
20-
- travis_retry docker build -t "$image" .
21-
- ~/official-images/test/run.sh "$image"
21+
- |
22+
(
23+
set -Eeuo pipefail
24+
set -x
25+
docker build -t "$image" .
26+
~/official-images/test/run.sh "$image"
27+
)
2228
2329
after_script:
2430
- docker images

10.0/Dockerfile

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
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
55
RUN 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
821
ENV GOSU_VERSION 1.10
922
RUN 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

3549
RUN 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/
3954
RUN 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

4460
ENV 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
7592
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
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]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
151+
echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
113152

114153
VOLUME /var/lib/mysql
115154

10.1/Dockerfile

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# vim:set ft=dockerfile:
2-
FROM debian:jessie
2+
FROM ubuntu:bionic
33

44
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
55
RUN 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
821
ENV GOSU_VERSION 1.10
922
RUN 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

3549
RUN 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/
3954
RUN 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

4460
ENV 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 ppc64le
7592
ENV MARIADB_MAJOR 10.1
76-
ENV MARIADB_VERSION 10.1.34+maria-1~jessie
93+
ENV MARIADB_VERSION 1:10.1.34+maria-1~bionic
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 bionic 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,34 @@ 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='mariadb-backup-10.1'; \
113+
apt-get update; \
114+
apt-get install -y \
95115
"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 \
116+
# percona-xtrabackup/mariadb-backup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos
117+
$backupPackage \
98118
socat \
99-
&& rm -rf /var/lib/apt/lists/* \
119+
; \
120+
rm -rf /var/lib/apt/lists/*; \
100121
# 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/* \
122+
sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/*; \
102123
# 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 \
124+
rm -rf /var/lib/mysql; \
125+
mkdir -p /var/lib/mysql /var/run/mysqld; \
126+
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld; \
105127
# 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 \
128+
chmod 777 /var/run/mysqld; \
107129
# comment out a few problematic configuration values
108-
&& find /etc/mysql/ -name '*.cnf' -print0 \
130+
find /etc/mysql/ -name '*.cnf' -print0 \
109131
| xargs -0 grep -lZE '^(bind-address|log)' \
110-
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
132+
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \
111133
# don't reverse lookup hostnames, they are usually another container
112-
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
134+
echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf
113135

114136
VOLUME /var/lib/mysql
115137

0 commit comments

Comments
 (0)