From a2a2f3a4dd65d48d0ad4c4b353082162e4eb0576 Mon Sep 17 00:00:00 2001 From: julesdevops Date: Sat, 22 Jan 2022 17:37:06 +0100 Subject: [PATCH] chore(dev): add xdebug support for docker setup --- dev/docker/Dockerfile | 2 ++ dev/docker/php/conf.d/xdebug.ini | 7 +++++++ docker-compose.yml | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 dev/docker/php/conf.d/xdebug.ini diff --git a/dev/docker/Dockerfile b/dev/docker/Dockerfile index 178ea9a6c..b1bf93349 100644 --- a/dev/docker/Dockerfile +++ b/dev/docker/Dockerfile @@ -8,6 +8,8 @@ RUN apt-get update -y \ && apt-get install -y git zip unzip libpng-dev libldap2-dev libzip-dev wait-for-it \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \ && docker-php-ext-install pdo_mysql gd ldap zip \ + && pecl install xdebug \ + && docker-php-ext-enable xdebug \ && a2enmod rewrite \ && sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \ && sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf diff --git a/dev/docker/php/conf.d/xdebug.ini b/dev/docker/php/conf.d/xdebug.ini new file mode 100644 index 000000000..8eaad6101 --- /dev/null +++ b/dev/docker/php/conf.d/xdebug.ini @@ -0,0 +1,7 @@ +zend_extension=xdebug + +[xdebug] +xdebug.mode=debug +xdebug.client_host=host.docker.internal +xdebug.start_with_request=yes +xdebug.client_port=9090 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 792025894..13648c121 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,7 +38,10 @@ services: - ${DEV_PORT:-8080}:80 volumes: - ./:/app + - ./dev/docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini entrypoint: /app/dev/docker/entrypoint.app.sh + extra_hosts: + - "host.docker.internal:host-gateway" node: image: node:alpine working_dir: /app