2019-08-12 09:20:06 +00:00
|
|
|
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
|
|
|
|
|
2020-06-04 16:51:32 +00:00
|
|
|
# Load our config file, substituting environment variables into the config.
|
2019-08-12 09:20:06 +00:00
|
|
|
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:
|
2023-08-24 21:02:47 +00:00
|
|
|
php:
|
|
|
|
condition: service_started
|
|
|
|
mysql:
|
|
|
|
condition: service_healthy
|
2019-08-12 09:20:06 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
# The PHP container.
|
|
|
|
##
|
|
|
|
php:
|
|
|
|
image: wordpressdevelop/php:${LOCAL_PHP-latest}
|
|
|
|
|
|
|
|
networks:
|
|
|
|
- wpdevnet
|
|
|
|
|
|
|
|
environment:
|
2021-08-26 18:40:15 +00:00
|
|
|
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
2022-06-21 23:45:19 +00:00
|
|
|
- XDEBUG_MODE=${LOCAL_PHP_XDEBUG_MODE-develop,debug}
|
2021-08-26 18:40:15 +00:00
|
|
|
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
|
|
|
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
|
|
|
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
2022-05-04 00:38:18 +00:00
|
|
|
- GITHUB_REF=${GITHUB_REF-false}
|
|
|
|
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
|
2019-08-12 09:20:06 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
|
|
|
|
- ./:/var/www
|
|
|
|
|
2022-08-13 23:23:26 +00:00
|
|
|
# Copy or delete the Memcached dropin plugin file as appropriate.
|
|
|
|
command: /bin/sh -c "if [ $LOCAL_PHP_MEMCACHED = true ]; then cp -n /var/www/tests/phpunit/includes/object-cache.php /var/www/src/wp-content/object-cache.php; else rm -f /var/www/src/wp-content/object-cache.php; fi && exec php-fpm"
|
|
|
|
|
2022-07-01 19:35:47 +00:00
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
|
|
init: true
|
|
|
|
|
2022-07-02 22:52:38 +00:00
|
|
|
extra_hosts:
|
|
|
|
- localhost:host-gateway
|
|
|
|
|
2019-08-12 09:20:06 +00:00
|
|
|
##
|
|
|
|
# The MySQL container.
|
|
|
|
##
|
|
|
|
mysql:
|
2024-02-08 19:10:10 +00:00
|
|
|
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
|
2019-08-12 09:20:06 +00:00
|
|
|
|
|
|
|
networks:
|
|
|
|
- wpdevnet
|
|
|
|
|
2020-02-09 21:20:25 +00:00
|
|
|
ports:
|
|
|
|
- "3306"
|
|
|
|
|
2019-08-12 09:20:06 +00:00
|
|
|
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.
|
2024-10-28 17:36:17 +00:00
|
|
|
command: ${LOCAL_DB_AUTH_OPTION-}
|
2019-08-12 09:20:06 +00:00
|
|
|
|
2023-08-24 21:02:47 +00:00
|
|
|
healthcheck:
|
|
|
|
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
|
|
|
|
timeout: 5s
|
|
|
|
interval: 5s
|
|
|
|
retries: 10
|
|
|
|
|
2019-08-12 09:20:06 +00:00
|
|
|
##
|
|
|
|
# The WP CLI container.
|
|
|
|
##
|
|
|
|
cli:
|
|
|
|
image: wordpressdevelop/cli:${LOCAL_PHP-latest}
|
|
|
|
|
|
|
|
networks:
|
|
|
|
- wpdevnet
|
|
|
|
|
|
|
|
environment:
|
2021-08-26 18:40:15 +00:00
|
|
|
- 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}
|
2019-08-12 09:20:06 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- ./:/var/www
|
|
|
|
|
|
|
|
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
|
|
|
init: true
|
|
|
|
|
2022-07-02 22:52:38 +00:00
|
|
|
extra_hosts:
|
|
|
|
- localhost:host-gateway
|
|
|
|
|
2023-08-24 21:02:47 +00:00
|
|
|
depends_on:
|
|
|
|
php:
|
|
|
|
condition: service_started
|
|
|
|
mysql:
|
|
|
|
condition: service_healthy
|
|
|
|
|
2022-08-13 23:23:26 +00:00
|
|
|
##
|
|
|
|
# The Memcached container.
|
|
|
|
##
|
|
|
|
memcached:
|
|
|
|
image: memcached
|
|
|
|
|
|
|
|
networks:
|
|
|
|
- wpdevnet
|
|
|
|
|
|
|
|
ports:
|
|
|
|
- 11211:11211
|
|
|
|
|
2023-08-24 21:02:47 +00:00
|
|
|
depends_on:
|
|
|
|
php:
|
|
|
|
condition: service_started
|
|
|
|
|
2019-08-12 09:20:06 +00:00
|
|
|
volumes:
|
|
|
|
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
|
|
|
|
mysql: {}
|
|
|
|
|
|
|
|
networks:
|
|
|
|
# Creating our own network allows us to connect between containers using their service name.
|
|
|
|
wpdevnet:
|
|
|
|
driver: bridge
|