Build/Test Tools: Support the use of MariaDB in the local Docker environment.

In addition to MySQL, WordPress also supports MariaDB for databases. This makes changes to the local Docker environment to allow MariaDB to be used instead, if desired.

The `LOCAL_DB_TYPE` environment variable will now be used to determine which type of database container to use. This will default to `mysql`, but will also accept `mariadb`.

The `LOCAL_MYSQL` environment variable (which previously held the version of MySQL to use) has been replaced with the new, more generic `LOCAL_DB_VERSION` environment variable.

This change will make it possible to perform automated testing on a wider array of supported database types and versions.

Props davidbaumwald.
Fixes #51744. See #30462.

git-svn-id: https://develop.svn.wordpress.org/trunk@49836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2020-12-18 15:27:33 +00:00
parent 3723941a9c
commit 3109b32fc9
2 changed files with 13 additions and 3 deletions

14
.env
View File

@@ -45,8 +45,18 @@ LOCAL_PHP_XDEBUG=false
# Whether or not to enable Memcached.
LOCAL_PHP_MEMCACHED=false
# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
LOCAL_MYSQL=5.7
# The database software to use.
#
# Supported values are `mysql` and `mariadb`.
LOCAL_DB_TYPE=mysql
# The database version to use.
#
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
#
# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions.
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
LOCAL_DB_VERSION=5.7
# The debug settings to add to `wp-config.php`.
LOCAL_WP_DEBUG=true

View File

@@ -53,7 +53,7 @@ services:
# The MySQL container.
##
mysql:
image: mysql:${LOCAL_MYSQL-latest}
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
networks:
- wpdevnet