Build/Test Tools: Always use the amd64 images for MariaDB and MySQL on the local development environment.

The `amd64/mysql` and `amd64/mariadb` official images from Docker are also compatible with an x64 host machine which means they can be used by default instead of only when the host uses ARM64.

Props bernhard-reiter, czapla, gmovr, withinboredom

Fixes #56528


git-svn-id: https://develop.svn.wordpress.org/trunk@54096 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2022-09-07 17:13:43 +00:00
parent e0e7d106f1
commit d51e65b78f
5 changed files with 3 additions and 15 deletions

4
.env
View File

@ -48,8 +48,8 @@ LOCAL_DB_TYPE=mysql
# #
# Defaults to 5.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above. # 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 `mysql`, see https://hub.docker.com/r/amd64/mysql for valid versions.
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions. # When using `mariadb`, see https://hub.docker.com/r/amd64/mariadb for valid versions.
## ##
LOCAL_DB_VERSION=5.7 LOCAL_DB_VERSION=5.7

View File

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

View File

@ -4,9 +4,5 @@ const { execSync } = require( 'child_process' );
dotenvExpand.expand( dotenv.config() ); dotenvExpand.expand( dotenv.config() );
if ( process.arch === 'arm64' ) {
process.env.LOCAL_DB_TYPE = `amd64/${process.env.LOCAL_DB_TYPE}`;
}
// Execute any docker-compose command passed to this script. // Execute any docker-compose command passed to this script.
execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } ); execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );

View File

@ -6,10 +6,6 @@ const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
dotenvExpand.expand( dotenv.config() ); dotenvExpand.expand( dotenv.config() );
if ( process.arch === 'arm64' ) {
process.env.LOCAL_DB_TYPE = `amd64/${process.env.LOCAL_DB_TYPE}`;
}
// Create wp-config.php. // Create wp-config.php.
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' ); wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );

View File

@ -4,10 +4,6 @@ const { execSync } = require( 'child_process' );
dotenvExpand.expand( dotenv.config() ); dotenvExpand.expand( dotenv.config() );
if ( process.arch === 'arm64' ) {
process.env.LOCAL_DB_TYPE = `amd64/${process.env.LOCAL_DB_TYPE}`;
}
// Start the local-env containers. // Start the local-env containers.
const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
? 'wordpress-develop memcached' ? 'wordpress-develop memcached'