-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable php debugging for wp-cli commands
- Loading branch information
1 parent
d1666a5
commit 92141cb
Showing
3 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ARG PHP_VERSION | ||
|
||
FROM wordpress:cli-php${PHP_VERSION:-8.1} | ||
|
||
# Switch to root user to ensure we have the necessary permissions | ||
USER root | ||
|
||
RUN apk add --update linux-headers | ||
|
||
# Install Xdebug | ||
RUN apk --no-cache add pcre-dev ${PHPIZE_DEPS} \ | ||
&& pecl install xdebug \ | ||
&& docker-php-ext-enable xdebug \ | ||
&& apk del pcre-dev ${PHPIZE_DEPS} | ||
|
||
# Configure Xdebug | ||
RUN { \ | ||
echo 'xdebug.mode=debug'; \ | ||
echo 'xdebug.start_with_request=yes'; \ | ||
echo 'xdebug.client_host=host.docker.internal'; \ | ||
echo 'xdebug.client_port=9003'; \ | ||
echo 'xdebug.log=/tmp/xdebug.log'; \ | ||
} > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
# Ensure the configuration is loaded | ||
RUN echo 'zend_extension=xdebug.so' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
# Switch back to the default user (if necessary) | ||
USER www-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters