Skip to content

Commit

Permalink
Added Xdebug to Docker image development tools with VSCode support
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Nov 30, 2024
1 parent adf157a commit 0ec63b7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"port": 9003,
"request": "launch",
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
}
]
}
10 changes: 9 additions & 1 deletion docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ RUN apk add --no-cache nodejs npm bash supercronic
# Install some PHP extensions
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN install-php-extensions zip pdo_mysql pdo_pgsql redis intl @composer
RUN install-php-extensions zip pdo_mysql pdo_pgsql redis intl xdebug @composer

# Configure Xdebug for remote debugging
# https://xdebug.org/docs/all_settings#mode
RUN echo "xdebug.mode=develop,debug" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.client_port=9003" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.log=/tmp/xdebug.log" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.start_with_request=yes" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.client_host=host.docker.internal" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini

# Set the working directory to the website files
WORKDIR /var/www/html
Expand Down

0 comments on commit 0ec63b7

Please sign in to comment.