-
-
Save tforster/876568b999119eb10188fdab5b422ab9 to your computer and use it in GitHub Desktop.
WordPress with XDebug inside Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Debug state | |
DEBUG=true | |
# MySQL configuration | |
DB_USER= | |
DB_PASSWORD= | |
DB_NAME= | |
DB_HOST=db:3306 | |
# WordPress configuration | |
WORDPRESS_DB_USER=$DB_USER | |
WORDPRESS_DB_PASSWORD=$DB_PASSWORD | |
WORDPRESS_DB_NAME=$DB_NAME | |
WORDPRESS_DB_HOST=$DB_HOST | |
WORDPRESS_TABLE_PREFIX=wp_ | |
WP_PATH=$PWD/src/ | |
XDEBUG_INI=$PWD/docker/xdebug.ini | |
THEME_NAME= | |
WP_DEBUG=$DEBUG | |
WP_DEBUG_LOG=$DEBUG | |
WP_DEBUG_DISPLAY=$DEBUG | |
CUSTOM_PLUGIN_1= | |
CUSTOM_PLUGIN_2= | |
# Docker configuration | |
WWW_PORT=12348 | |
DB_PORT=12344 | |
COMPOSE_PROJECT_NAME= | |
ORG= | |
# WPEngine configuration | |
WPE_DEV= | |
WPE_STAGE= | |
WPE_PROD= | |
WPE_SITE=$WPE_STAGE | |
# SSH configuration | |
SSH_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
db: | |
image: mysql:5.7 | |
restart: always | |
container_name: db.dev.${ORG} | |
environment: | |
- MYSQL_USER=${DB_USER} | |
- MYSQL_PASSWORD=${DB_PASSWORD} | |
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD} | |
- MYSQL_DATABASE=${DB_NAME} | |
ports: | |
- "${DB_PORT}:3306" | |
www: | |
user: "1000:1000" | |
image: www.${ORG}:latest | |
build: | |
context: . | |
dockerfile: wordpress.dockerfile | |
restart: always | |
container_name: www.dev.${ORG} | |
environment: | |
- WORDPRESS_DB_HOST=${DB_HOST} | |
- WORDPRESS_DB_USER=${DB_USER} | |
- WORDPRESS_DB_PASSWORD=${DB_PASSWORD} | |
- WORDPRESS_DB_NAME=${DB_NAME} | |
- WP_DEBUG=${WP_DEBUG} | |
volumes: | |
- ${WP_PATH}:/var/www/html/wp-content:rw | |
- ${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini | |
ports: | |
- "${WWW_PORT}:80" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Listen for Xdebug", | |
"type": "php", | |
"request": "launch", | |
"log": true, | |
"port": 9003, | |
"pathMappings": { | |
"/var/www/html/wp-content": "${workspaceRoot}/src" | |
}, | |
"externalConsole": false, | |
"ignore": [ | |
"**/vendor/**/*.php" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM wordpress | |
RUN pecl install xdebug \ | |
&& docker-php-ext-enable xdebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zend_extension=xdebug.so | |
xdebug.client_host=host.docker.internal | |
xdebug.client_port=9003 | |
xdebug.discover_client_host=1 | |
xdebug.log=/tmp/xdebug.log | |
xdebug.mode=debug | |
xdebug.start_with_request=yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment