mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 04:48:25 +01:00
181144c200
This commit introduces the Docker-based local WordPress development environment to the 4.7 branch and converts the Travis test jobs to utilize this environment for easier and more consistent testing. Until existing blockers with the PHP 5.2 Docker container can be solved, the PHP 5.2 test job will remain using the Travis `precise` image. Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.7 branch. See #48301, #47767. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@49532 602fd350-edb4-49c9-b593-d223f7449a82
137 lines
3.3 KiB
YAML
137 lines
3.3 KiB
YAML
version: '3.7'
|
|
|
|
services:
|
|
|
|
##
|
|
# The web server container.
|
|
##
|
|
wordpress-develop:
|
|
image: nginx:alpine
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
ports:
|
|
- ${LOCAL_PORT-8889}:80
|
|
|
|
environment:
|
|
LOCAL_DIR: ${LOCAL_DIR-src}
|
|
|
|
volumes:
|
|
- ./tools/local-env/default.template:/etc/nginx/conf.d/default.template
|
|
- ./:/var/www
|
|
|
|
# Load our config file, substituting environment variables into the config.
|
|
command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
|
|
|
|
depends_on:
|
|
- php
|
|
|
|
##
|
|
# The PHP container.
|
|
##
|
|
php:
|
|
image: wordpressdevelop/php:${LOCAL_PHP-7.1-fpm}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
environment:
|
|
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
|
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
|
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
|
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
|
|
|
volumes:
|
|
- ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
|
|
- ./:/var/www
|
|
|
|
depends_on:
|
|
- mysql
|
|
|
|
##
|
|
# The MySQL container.
|
|
##
|
|
mysql:
|
|
image: mysql:${LOCAL_MYSQL-5.7}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
ports:
|
|
- "3306"
|
|
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
volumes:
|
|
- ./tools/local-env/mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
|
|
- mysql:/var/lib/mysql
|
|
|
|
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
|
|
command: --default-authentication-plugin=mysql_native_password
|
|
|
|
##
|
|
# The WP CLI container.
|
|
##
|
|
cli:
|
|
image: wordpressdevelop/cli:${LOCAL_PHP-7.1-fpm}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
environment:
|
|
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
|
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
|
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
|
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
|
|
|
volumes:
|
|
- ./:/var/www
|
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
init: true
|
|
|
|
##
|
|
# The PHPUnit container.
|
|
##
|
|
phpunit:
|
|
image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-6-php-7.1-fpm}
|
|
|
|
networks:
|
|
- wpdevnet
|
|
|
|
environment:
|
|
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
|
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
|
LOCAL_DIR: ${LOCAL_DIR-src}
|
|
WP_MULTISITE: ${WP_MULTISITE-false}
|
|
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
|
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
|
TRAVIS_BRANCH: ${TRAVIS_BRANCH-false}
|
|
TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST-false}
|
|
GITHUB_REF: ${GITHUB_REF-false}
|
|
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME-false}
|
|
|
|
volumes:
|
|
- ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
|
|
- ./:/var/www
|
|
- phpunit-uploads:/var/www/${LOCAL_DIR-src}/wp-content/uploads
|
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
init: true
|
|
|
|
depends_on:
|
|
- mysql
|
|
|
|
volumes:
|
|
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
|
|
mysql: {}
|
|
# Using a volume for the uploads directory improves PHPUnit performance.
|
|
phpunit-uploads: {}
|
|
|
|
networks:
|
|
# Creating our own network allows us to connect between containers using their service name.
|
|
wpdevnet:
|
|
driver: bridge
|