Skip to content

Commit

Permalink
Merge pull request radondb#123 from zhyass/main
Browse files Browse the repository at this point in the history
dockerfiles/mysql: update mysql version to 5.7.34 and add init operator
  • Loading branch information
andyli029 authored Jun 24, 2021
2 parents a5f5060 + ab82a54 commit 9d3740e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 31 deletions.
35 changes: 7 additions & 28 deletions charts/helm/dockerfiles/mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,17 @@ RUN set -ex; \
--home-dir /var/lib/mysql \
--no-create-home \
--gid mysql \
mysql; \
# replace the source list.
echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list; \
echo "# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list; \
echo "#deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list; \
apt-get update; \
if ! which gpg; then \
apt-get install -y --no-install-recommends gnupg; \
fi; \
if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
apt-get install -y --no-install-recommends dirmngr; \
fi; \
rm -rf /var/lib/apt/lists/*
mysql

ENV PS_VERSION 5.7.33-36-1
ENV PS_VERSION 5.7.34-37-1
ENV OS_VER focal
ENV FULL_PERCONA_VERSION "$PS_VERSION.$OS_VER"

RUN set -ex; \
key='9334A25F8507EFA5'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keys.gnupg.net --recv-keys "$key"; \
gpg --batch --export $key > /etc/apt/trusted.gpg.d/mysql.gpg; \
command -v gpgconf > /dev/null && gpgconf --kill all || :; \
rm -r "$GNUPGHOME"; \
apt-key list > /dev/null; \
echo "deb http://repo.percona.com/apt focal main\ndeb-src http://repo.percona.com/apt focal main">> /etc/apt/sources.list.d/mysql.list; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg2 wget lsb-release curl; \
wget -P /tmp --no-check-certificate https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; \
dpkg -i /tmp/percona-release_latest.$(lsb_release -sc)_all.deb; \
apt-get update; \
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true; \
{ \
Expand All @@ -60,7 +39,7 @@ RUN set -ex; \
\
apt-get clean; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/lib/mysql /etc/alternatives/my.cnf /etc/mysql/*; \
mkdir -p /var/lib/mysql /var/log/mysql /var/run/mysqld /etc/mysql/conf.d; \
mkdir -p /var/lib/mysql /var/log/mysql /var/run/mysqld /etc/mysql/conf.d /docker-entrypoint-initdb.d; \
# allow to change config files
chown -R mysql:mysql /var/lib/mysql /var/log/mysql /var/run/mysqld /etc/mysql; \
# 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
Expand Down
12 changes: 9 additions & 3 deletions charts/helm/dockerfiles/mysql/mysql-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ process_init_file() {
local mysql=( "$@" )

case "$f" in
*.sh) echo "$0: running $f"; . "$f" ;;
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
*.sh) echo "$0: running $f"; . "$f" ;;
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
*) echo "$0: ignoring $f" ;;
esac
echo
Expand Down Expand Up @@ -144,6 +144,12 @@ if [ ! -d "$DATADIR/mysql" ]; then
echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
echo 'reset master;' | "${mysql[@]}"

echo
ls /docker-entrypoint-initdb.d/ > /dev/null
for f in /docker-entrypoint-initdb.d/*; do
process_init_file "$f" "${mysql[@]}"
done

if ! kill -s TERM "$pid" || ! wait "$pid"; then
echo >&2 'MySQL init process failed.'
exit 1
Expand Down

0 comments on commit 9d3740e

Please sign in to comment.