-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from moderntribe/feat/moar-debug
Finer Debug support in the WP service
- Loading branch information
Showing
5 changed files
with
49 additions
and
3 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
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,21 @@ | ||
ARG WORDPRESS_IMAGE_VERSION="latest" | ||
|
||
FROM wordpress:${WORDPRESS_IMAGE_VERSION} | ||
|
||
# Pull in an helper library to install PHP extensions. | ||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ | ||
# Install the XDebug extension. | ||
RUN install-php-extensions xdebug | ||
# Configure XDebug to autostart on all requests. | ||
RUN echo 'xdebug.remote_autostart=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
# Make the XDebug configuration file world-read/writeable as the user updating it might not be a sudo-er. | ||
RUN chmod a+rw /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
# Change the entrypoint to enable/disable XDebug depending on the XDEBUG_DISABLE env var. | ||
COPY tric-entrypoint.sh /usr/local/bin/tric-entrypoint.sh | ||
# Make the tric entrypoing world-executable as the user that executes it might not be a sudo-er. | ||
RUN chmod a+x /usr/local/bin/tric-entrypoint.sh | ||
# Change the default entrypoint to be the tric one. | ||
ENTRYPOINT ["/usr/local/bin/tric-entrypoint.sh"] | ||
# We need to explicitly set the CMD since we changed the ENTRYPOINT. | ||
CMD ["apache2-foreground"] |
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,12 @@ | ||
#! /usr/bin/env bash | ||
|
||
# If XDEBUG_DISABLE=1, then disable the XDebug extension completely. | ||
if [ ! -n "${XDEBUG_DISABLE}" ]; then | ||
echo "Disabling XDebug extension ..." | ||
XDEBUG_INI_FILE="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini" | ||
sed -i.bak '/^zend_extension.*xdebug.so/ s/zend_ex/;zend_ex/g' "${XDEBUG_INI_FILE}" | ||
echo -ne " \e[32mdone\e[0m" | ||
fi | ||
|
||
# Finally call the original image entrypoint passing through the CMD arguments, keep the arguments unpacked. | ||
exec /usr/local/bin/docker-entrypoint.sh "$@" |
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