Skip to content

Commit

Permalink
Vitess MySQL Docker Image (#14158)
Browse files Browse the repository at this point in the history
  • Loading branch information
frouioui authored Oct 3, 2023
1 parent 0114a42 commit 79bb6e3
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 33 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
14 changes: 12 additions & 2 deletions changelog/19.0/19.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@

- **[Major Changes](#major-changes)**
- **[Deprecations and Deletions](#deprecations-and-deletions)**

- **[Docker](#docker)**
- [New MySQL Image](#mysql-image)

## <a id="major-changes"/>Major Changes

### <a id="deprecations-and-deletions"/>Deprecations and Deletions

- The `MYSQL_FLAVOR` environment variable is now removed from all Docker Images.
- The `MYSQL_FLAVOR` environment variable is now removed from all Docker Images.

### <a id="docker"/>Docker

#### <a id="mysql-image"/>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`.
71 changes: 40 additions & 31 deletions docker/lite/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flavor>
# Usage: install_dependencies.sh <flavor> <version (optional)>

set -euo pipefail

FLAVOR="$1"
VERSION=""
if [ $# -eq 2 ]; then
VERSION="$2"
fi

export DEBIAN_FRONTEND=noninteractive

KEYSERVERS=(
Expand Down Expand Up @@ -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
)
;;
Expand Down
1 change: 1 addition & 0 deletions docker/mysql/Dockerfile
28 changes: 28 additions & 0 deletions docker/mysql/Dockerfile.8.0.30
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions docker/mysql/Dockerfile.8.0.34
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 79bb6e3

Please sign in to comment.