First commit
This commit is contained in:
parent
cb7fcbe36e
commit
55b3e917ac
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
data
|
||||||
|
.env*
|
24
Dockerfile-wordpress-xdebug
Normal file
24
Dockerfile-wordpress-xdebug
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Original: https://marioyepes.com/setup-debug-php-docker-visual-studio-code
|
||||||
|
|
||||||
|
ARG DOCKER_IMG_TAG
|
||||||
|
|
||||||
|
# Source image
|
||||||
|
FROM wordpress:${DOCKER_IMG_TAG}
|
||||||
|
|
||||||
|
# We're going to use this path multile times. So save it in a variable.
|
||||||
|
ARG XDEBUG_INI="/usr/local/etc/php/conf.d/xdebug.ini"
|
||||||
|
|
||||||
|
COPY ./wordpress-xdebug/plugins /root/wp-plugins
|
||||||
|
|
||||||
|
# Install AND configure Xdebug
|
||||||
|
RUN pecl install xdebug \
|
||||||
|
&& docker-php-ext-enable xdebug \
|
||||||
|
&& echo "[xdebug]" > $XDEBUG_INI \
|
||||||
|
&& echo "xdebug.mode = debug" >> $XDEBUG_INI \
|
||||||
|
&& echo "xdebug.start_with_request = trigger" >> $XDEBUG_INI \
|
||||||
|
&& echo "xdebug.client_port = 9003" >> $XDEBUG_INI \
|
||||||
|
&& echo "xdebug.client_host = 'host.docker.internal'" >> $XDEBUG_INI \
|
||||||
|
&& echo "xdebug.log = /tmp/xdebug.log" >> $XDEBUG_INI
|
||||||
|
|
||||||
|
RUN cp -Rf /root/wp-plugins/* /var/www/html/wp-content/plugins/ \
|
||||||
|
&& chown -R www-data:www-data /var/www/html/wp-content/plugins/
|
65
docker-compose.yml
Normal file
65
docker-compose.yml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:${MARIADB_IMG_TAG}
|
||||||
|
command: "--log-bin=mysqld-bin"
|
||||||
|
# volumes:
|
||||||
|
# - ./data/mysql:/var/lib/mysql
|
||||||
|
restart: "no"
|
||||||
|
environment:
|
||||||
|
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
|
MARIADB_DATABASE: ${DB_DATABASE}
|
||||||
|
MARIADB_USER: ${DB_USER}
|
||||||
|
MARIADB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin:latest
|
||||||
|
restart: "no"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- ${PHPMYADMIN_LOCAL_PORT}:80
|
||||||
|
environment:
|
||||||
|
PMA_ARBITRARY: "1"
|
||||||
|
PMA_HOST: db
|
||||||
|
PMA_USER: root
|
||||||
|
PMA_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
|
|
||||||
|
# Optional for WordPress redis cache plugin
|
||||||
|
redis:
|
||||||
|
# restart: always
|
||||||
|
restart: "no"
|
||||||
|
image: bitnami/redis:${REDIS_IMG_TAG}
|
||||||
|
environment:
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
# volumes:
|
||||||
|
# - ./data/redis:/bitnami/redis/data
|
||||||
|
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
|
||||||
|
|
||||||
|
wordpress:
|
||||||
|
# image: wordpress:${WORDPRESS_IMG_TAG}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-wordpress-xdebug
|
||||||
|
args:
|
||||||
|
- DOCKER_IMG_TAG=${WORDPRESS_IMG_TAG}
|
||||||
|
image: badbuta/wordpress-debug:${WORDPRESS_IMG_TAG}
|
||||||
|
# env_file:
|
||||||
|
# - .env
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
volumes:
|
||||||
|
# - ./data/wp-content:/var/www/html/wp-content
|
||||||
|
# - ./data/php/upload.ini:/usr/local/etc/php/conf.d/uploads.ini
|
||||||
|
- ./wordpress-xdebug/plugins/wordpress-docker-xdebug/plugin.php:/var/www/html/wp-content/plugins/wordpress-docker-xdebug/plugin.php:ro
|
||||||
|
ports:
|
||||||
|
- ${WORDPRESS_LOCAL_PORT}:80
|
||||||
|
# restart: always
|
||||||
|
restart: "no"
|
||||||
|
environment:
|
||||||
|
WORDPRESS_DB_HOST: db
|
||||||
|
WORDPRESS_DB_NAME: ${DB_DATABASE}
|
||||||
|
WORDPRESS_DB_USER: ${DB_USER}
|
||||||
|
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
WORDPRESS_CONFIG_EXTRA: ${WORDPRESS_CONFIG_EXTRA}
|
11
sample.env
Normal file
11
sample.env
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
DB_ROOT_PASSWORD=wordpress
|
||||||
|
DB_DATABASE=wordpress
|
||||||
|
DB_USER=wordpress
|
||||||
|
DB_PASSWORD=wordpress
|
||||||
|
|
||||||
|
MARIADB_IMG_TAG=10.10
|
||||||
|
PHPMYADMIN_LOCAL_PORT=40081
|
||||||
|
REDIS_IMG_TAG=6.2.8
|
||||||
|
WORDPRESS_IMG_TAG=6.1.1
|
||||||
|
WORDPRESS_LOCAL_PORT=40080
|
||||||
|
WORDPRESS_CONFIG_EXTRA="define( 'WP_AUTO_UPDATE_CORE', false ); \n define( 'WP_HOME', 'http://localhost:40080' ); \n define( 'WP_SITEURL', 'http://localhost:40080' ); \n define( 'WP_REDIS_HOST', 'redis' ); \n define( 'WP_REDIS_PORT', 6379 ); \n // define( 'WP_REDIS_PASSWORD', 'secret' ); \n define( 'WP_REDIS_TIMEOUT', 1 ); \n define( 'WP_REDIS_READ_TIMEOUT', 1 ); \n define( 'WP_REDIS_DATABASE', 0 );"
|
44
wordpress-xdebug/plugins/wordpress-docker-xdebug/plugin.php
Normal file
44
wordpress-xdebug/plugins/wordpress-docker-xdebug/plugin.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WordPress Docker Xdebug plugin
|
||||||
|
*
|
||||||
|
* @package WpDockerXdebug
|
||||||
|
* @author Mario Yepes
|
||||||
|
* @copyright 2020 Mario Yepes
|
||||||
|
* @license GPL-2.0-or-later
|
||||||
|
*
|
||||||
|
* @wordpress-plugin
|
||||||
|
* Plugin Name: WordPress Docker Xdebug plugin
|
||||||
|
* Plugin URI: https://marioyepes.com
|
||||||
|
* Description: A plugin that shows the status of Xdebug in Tools > Xdebug Info
|
||||||
|
* Version: 1.0.0
|
||||||
|
* Requires at least: 5.2
|
||||||
|
* Requires PHP: 7.2
|
||||||
|
* Author: Mario Yepes
|
||||||
|
* Author URI: https://marioyepes.com
|
||||||
|
* Text Domain: wordpress-docker-xdebug
|
||||||
|
* License: GPL v2 or later
|
||||||
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
|
* Update URI: https://marioyepes.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
add_action( 'admin_menu', 'add_php_info_page' );
|
||||||
|
|
||||||
|
function add_php_info_page() {
|
||||||
|
add_submenu_page(
|
||||||
|
'tools.php', // Parent page
|
||||||
|
'Xdebug Info', // Menu title
|
||||||
|
'Xdebug Info', // Page title
|
||||||
|
'manage_options', // user "role"
|
||||||
|
'php-info-page', // page slug
|
||||||
|
'php_info_page_body'); // callback function
|
||||||
|
}
|
||||||
|
|
||||||
|
function php_info_page_body() {
|
||||||
|
$message = '<h2>No Xdebug enabled</h2>';
|
||||||
|
if ( function_exists( 'xdebug_info' ) ) {
|
||||||
|
xdebug_info();
|
||||||
|
} else {
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user