From 79bb6e3babd4c5df34bcb67032fff1597d026e09 Mon Sep 17 00:00:00 2001
From: Florent Poinsard <35779988+frouioui@users.noreply.github.com>
Date: Tue, 3 Oct 2023 08:55:42 -0500
Subject: [PATCH] Vitess MySQL Docker Image (#14158)
---
Makefile | 7 +++
changelog/19.0/19.0.0/summary.md | 14 +++++-
docker/lite/install_dependencies.sh | 71 ++++++++++++++++-------------
docker/mysql/Dockerfile | 1 +
docker/mysql/Dockerfile.8.0.30 | 28 ++++++++++++
docker/mysql/Dockerfile.8.0.34 | 28 ++++++++++++
6 files changed, 116 insertions(+), 33 deletions(-)
create mode 120000 docker/mysql/Dockerfile
create mode 100644 docker/mysql/Dockerfile.8.0.30
create mode 100644 docker/mysql/Dockerfile.8.0.34
diff --git a/Makefile b/Makefile
index e1831f76b3a..6ec9d8e06c6 100644
--- a/Makefile
+++ b/Makefile
@@ -324,6 +324,13 @@ $(DOCKER_BASE_TARGETS): docker_base_%:
docker_base_all: docker_base $(DOCKER_BASE_TARGETS)
+DOCKER_MYSQL_VERSIONS = 8.0.30 8.0.34
+docker_mysql:
+ for i in $(DOCKER_MYSQL_VERSIONS); do echo "building vitess/mysql:$$i"; ${call build_docker_image,docker/mysql/Dockerfile.$$i,vitess/mysql:$$i} || exit 1; done
+
+docker_mysql_push:
+ for i in $(DOCKER_MYSQL_VERSIONS); do echo "pushing vitess/mysql:$$i"; docker push vitess/mysql:$$i || exit 1; done
+
docker_lite:
${call build_docker_image,docker/lite/Dockerfile,vitess/lite}
diff --git a/changelog/19.0/19.0.0/summary.md b/changelog/19.0/19.0.0/summary.md
index 849992aa9d0..5d413c25cae 100644
--- a/changelog/19.0/19.0.0/summary.md
+++ b/changelog/19.0/19.0.0/summary.md
@@ -4,10 +4,20 @@
- **[Major Changes](#major-changes)**
- **[Deprecations and Deletions](#deprecations-and-deletions)**
-
+ - **[Docker](#docker)**
+ - [New MySQL Image](#mysql-image)
## Major Changes
### Deprecations and Deletions
-- The `MYSQL_FLAVOR` environment variable is now removed from all Docker Images.
\ No newline at end of file
+- The `MYSQL_FLAVOR` environment variable is now removed from all Docker Images.
+
+### Docker
+
+#### New MySQL Image
+
+In `v19.0` the Vitess team is shipping a new image: `vitess/mysql`.
+This lightweight image is a replacement of `vitess/lite` to only run `mysqld`.
+
+Several tags are available to let you choose what version of MySQL you want to use: `vitess/mysql:8.0.30`, `vitess/mysql:8.0.34`.
diff --git a/docker/lite/install_dependencies.sh b/docker/lite/install_dependencies.sh
index 2175df5def3..0cbc47fd9cf 100755
--- a/docker/lite/install_dependencies.sh
+++ b/docker/lite/install_dependencies.sh
@@ -3,11 +3,16 @@
# This is a script that gets run as part of the Dockerfile build
# to install dependencies for the vitess/lite family of images.
#
-# Usage: install_dependencies.sh
+# Usage: install_dependencies.sh
set -euo pipefail
FLAVOR="$1"
+VERSION=""
+if [ $# -eq 2 ]; then
+ VERSION="$2"
+fi
+
export DEBIAN_FRONTEND=noninteractive
KEYSERVERS=(
@@ -67,42 +72,46 @@ apt-get install -y --no-install-recommends "${BASE_PACKAGES[@]}"
# Packages specific to certain flavors.
case "${FLAVOR}" in
mysql57)
- mysql57_version=5.7.31
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/libmysqlclient20_${mysql57_version}-1debian10_amd64.deb /tmp/libmysqlclient20_${mysql57_version}-1debian10_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-community-client_${mysql57_version}-1debian10_amd64.deb /tmp/mysql-community-client_${mysql57_version}-1debian10_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-client_${mysql57_version}-1debian10_amd64.deb /tmp/mysql-client_${mysql57_version}-1debian10_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-community-server_${mysql57_version}-1debian10_amd64.deb /tmp/mysql-community-server_${mysql57_version}-1debian10_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-server_${mysql57_version}-1debian10_amd64.deb /tmp/mysql-server_${mysql57_version}-1debian10_amd64.deb
+ if [ -z "$VERSION" ]; then
+ VERSION=5.7.31
+ fi
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/libmysqlclient20_${VERSION}-1debian10_amd64.deb /tmp/libmysqlclient20_${VERSION}-1debian10_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-community-client_${VERSION}-1debian10_amd64.deb /tmp/mysql-community-client_${VERSION}-1debian10_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-client_${VERSION}-1debian10_amd64.deb /tmp/mysql-client_${VERSION}-1debian10_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-community-server_${VERSION}-1debian10_amd64.deb /tmp/mysql-community-server_${VERSION}-1debian10_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-5.7/m/mysql-community/mysql-server_${VERSION}-1debian10_amd64.deb /tmp/mysql-server_${VERSION}-1debian10_amd64.deb
PACKAGES=(
- /tmp/libmysqlclient20_${mysql57_version}-1debian10_amd64.deb
- /tmp/mysql-community-client_${mysql57_version}-1debian10_amd64.deb
- /tmp/mysql-client_${mysql57_version}-1debian10_amd64.deb
- /tmp/mysql-community-server_${mysql57_version}-1debian10_amd64.deb
- /tmp/mysql-server_${mysql57_version}-1debian10_amd64.deb
+ /tmp/libmysqlclient20_${VERSION}-1debian10_amd64.deb
+ /tmp/mysql-community-client_${VERSION}-1debian10_amd64.deb
+ /tmp/mysql-client_${VERSION}-1debian10_amd64.deb
+ /tmp/mysql-community-server_${VERSION}-1debian10_amd64.deb
+ /tmp/mysql-server_${VERSION}-1debian10_amd64.deb
percona-xtrabackup-24
)
;;
mysql80)
- mysql8_version=8.0.30
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-common_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-common_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb /tmp/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-client_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-client_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-server_${mysql8_version}-1debian11_amd64.deb
- do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-server_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-server_${mysql8_version}-1debian11_amd64.deb
+ if [ -z "$VERSION" ]; then
+ VERSION=8.0.30
+ fi
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-common_${VERSION}-1debian11_amd64.deb /tmp/mysql-common_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/libmysqlclient21_${VERSION}-1debian11_amd64.deb /tmp/libmysqlclient21_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-core_${VERSION}-1debian11_amd64.deb /tmp/mysql-community-client-core_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-plugins_${VERSION}-1debian11_amd64.deb /tmp/mysql-community-client-plugins_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client_${VERSION}-1debian11_amd64.deb /tmp/mysql-community-client_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-client_${VERSION}-1debian11_amd64.deb /tmp/mysql-client_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server-core_${VERSION}-1debian11_amd64.deb /tmp/mysql-community-server-core_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server_${VERSION}-1debian11_amd64.deb /tmp/mysql-community-server_${VERSION}-1debian11_amd64.deb
+ do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-server_${VERSION}-1debian11_amd64.deb /tmp/mysql-server_${VERSION}-1debian11_amd64.deb
PACKAGES=(
- /tmp/mysql-common_${mysql8_version}-1debian11_amd64.deb
- /tmp/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-community-client_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-client_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-community-server_${mysql8_version}-1debian11_amd64.deb
- /tmp/mysql-server_${mysql8_version}-1debian11_amd64.deb
+ /tmp/mysql-common_${VERSION}-1debian11_amd64.deb
+ /tmp/libmysqlclient21_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-community-client-core_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-community-client-plugins_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-community-client_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-client_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-community-server-core_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-community-server_${VERSION}-1debian11_amd64.deb
+ /tmp/mysql-server_${VERSION}-1debian11_amd64.deb
percona-xtrabackup-80
)
;;
diff --git a/docker/mysql/Dockerfile b/docker/mysql/Dockerfile
new file mode 120000
index 00000000000..6671907eaf2
--- /dev/null
+++ b/docker/mysql/Dockerfile
@@ -0,0 +1 @@
+Dockerfile.8.0.30
\ No newline at end of file
diff --git a/docker/mysql/Dockerfile.8.0.30 b/docker/mysql/Dockerfile.8.0.30
new file mode 100644
index 00000000000..5b5e68263fe
--- /dev/null
+++ b/docker/mysql/Dockerfile.8.0.30
@@ -0,0 +1,28 @@
+# Copyright 2023 The Vitess Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM debian:bullseye-slim
+
+RUN mkdir -p /vt/dist
+
+# Install dependencies
+COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh
+RUN /vt/dist/install_dependencies.sh mysql80 8.0.30
+
+# Set up Vitess user and directory tree.
+RUN groupadd -r vitess && useradd -r -g vitess vitess
+RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
+
+VOLUME /vt/vtdataroot
+USER vitess
\ No newline at end of file
diff --git a/docker/mysql/Dockerfile.8.0.34 b/docker/mysql/Dockerfile.8.0.34
new file mode 100644
index 00000000000..5bd81d9802c
--- /dev/null
+++ b/docker/mysql/Dockerfile.8.0.34
@@ -0,0 +1,28 @@
+# Copyright 2023 The Vitess Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM debian:bullseye-slim
+
+RUN mkdir -p /vt/dist
+
+# Install dependencies
+COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh
+RUN /vt/dist/install_dependencies.sh mysql80 8.0.34
+
+# Set up Vitess user and directory tree.
+RUN groupadd -r vitess && useradd -r -g vitess vitess
+RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
+
+VOLUME /vt/vtdataroot
+USER vitess
\ No newline at end of file