From 4311bac7e48cdf8c0934f6bd0331ff8429847fb3 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 12 Aug 2019 09:20:06 +0000 Subject: [PATCH] Build Tools: Add the `docker-compose.yml` file, missed in [45783]. See #47767. git-svn-id: https://develop.svn.wordpress.org/trunk@45784 602fd350-edb4-49c9-b593-d223f7449a82 --- docker-compose.yml | 121 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..6fc52fc4ab --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,121 @@ +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, substituning 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-latest} + + networks: + - wpdevnet + + environment: + LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false} + LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false} + + 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-latest} + + networks: + - wpdevnet + + 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-latest} + + networks: + - wpdevnet + + environment: + LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false} + LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false} + + 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_PHP-latest} + + networks: + - wpdevnet + + environment: + LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false} + LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false} + + volumes: + - ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini + - ./:/wordpress-develop + - phpunit-uploads:/wordpress-develop/${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