Skip to content

Commit f102cbf

Browse files
committed
NO-ISSUE improve the local environment to use xdebug
1 parent b20152d commit f102cbf

3 files changed

Lines changed: 18 additions & 11 deletions

File tree

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ services:
88
- ./tests/tmp/.composer:/root/.composer:rw
99
- .:/app
1010
environment:
11+
- PHP_IDE_CONFIG='serverName=host.docker.internal'
12+
- XDEBUG_TRIGGER=1
1113
- TZ=UTC
1214
- TIMEZONE=UTC
1315
- IN_DOCKER=docker
1416
- PHP_XDEBUG_ENABLED=1
1517
- XDEBUG_CONFIG="remote_host=host.docker.internal"
1618
- PHP_IDE_CONFIG="serverName=Docker"
19+
extra_hosts:
20+
- "host.docker.internal:host-gateway"
1721
tty: true
1822
node:
1923
image: node:12

tests/docker/Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN apt-get update && \
2222
--no-install-recommends && \
2323
apt-get clean && \
2424
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
25-
&& pecl install xdebug-2.9.6 \
25+
&& pecl install xdebug-3.1.5 \
2626
&& docker-php-ext-enable xdebug \
2727
&& docker-php-ext-install \
2828
zip \
@@ -43,15 +43,6 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
4343
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer \
4444
&& rm -f /tmp/composer-setup.*
4545

46-
# Enable Xdebug
47-
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
48-
49-
RUN echo "xdebug.idekey=PHP_STORM" >> $XDEBUGINI_PATH && \
50-
echo "xdebug.default_enable=1" >> $XDEBUGINI_PATH && \
51-
echo "xdebug.remote_enable=1" >> $XDEBUGINI_PATH && \
52-
echo "xdebug.remote_connect_back=1" >> $XDEBUGINI_PATH && \
53-
echo "xdebug.remote_log=xdebug_remote.log" >> $XDEBUGINI_PATH && \
54-
echo "xdebug.remote_port=9000" >> $XDEBUGINI_PATH && \
55-
echo "xdebug.remote_autostart=1" >> $XDEBUGINI_PATH
46+
COPY ./tests/docker/rootfs /
5647

5748
WORKDIR /app
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
zend_extension=xdebug.so
2+
xdebug.mode=debug
3+
xdebug.start_with_request=yes
4+
xdebug.discover_client_host=false
5+
## You need this for configure it in your IDE
6+
xdebug.idekey="OPENAPI"
7+
## This is for xdebug php cli
8+
xdebug.trigger_value="OPENAPI"
9+
xdebug.client_port=9003
10+
xdebug.log_level=7
11+
## And here we set that we do it through docker
12+
xdebug.client_host=host.docker.internal

0 commit comments

Comments
 (0)