Skip to content

Commit

Permalink
Added xdebug to the project along with the debug command for running …
Browse files Browse the repository at this point in the history
…an artisan command in debug mode (#209)
  • Loading branch information
nhaynes authored Aug 3, 2021
1 parent 9b4f0a3 commit 5117805
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions bin/sail
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ if [ $# -gt 0 ]; then
sail_is_not_running
fi

# Proxy the "debug" command to the "php artisan" binary on the application container with xdebug enabled...
elif [ "$1" == "debug" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
docker-compose exec \
-u sail \
-e XDEBUG_SESSION=1 \
"$APP_SERVICE" \
php artisan "$@"
else
sail_is_not_running
fi

# Proxy the "test" command to the "php artisan test" Artisan command...
elif [ "$1" == "test" ]; then
shift 1
Expand Down
2 changes: 1 addition & 1 deletion runtimes/7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN apt-get update \
php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \
php7.4-intl php7.4-readline php7.4-pcov \
php7.4-msgpack php7.4-igbinary php7.4-ldap \
php7.4-redis \
php7.4-redis php7.4-xdebug \
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN apt-get update \
php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
php8.0-intl php8.0-readline php8.0-pcov \
php8.0-msgpack php8.0-igbinary php8.0-ldap \
php8.0-redis php8.0-swoole \
php8.0-redis php8.0-swoole php8.0-xdebug \
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
Expand Down
2 changes: 2 additions & 0 deletions stubs/docker-compose.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
Expand Down

0 comments on commit 5117805

Please sign in to comment.