From 80fe53cf20f67abdfc8b7222f6d7047be3820820 Mon Sep 17 00:00:00 2001 From: shibafu Date: Mon, 18 Mar 2019 23:22:28 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Linux+Docker=E3=81=AA=E9=96=8B=E7=99=BA?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E3=81=A7xdebug=E3=81=8C=E4=BD=BF=E3=81=88?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=81=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=83=90=E3=83=83=E3=82=AF=E5=85=88IP=E3=82=A2?= =?UTF-8?q?=E3=83=89=E3=83=AC=E3=82=B9=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bin/tissue-entrypoint.sh | 1 + dist/php.d/99-xdebug.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/bin/tissue-entrypoint.sh b/dist/bin/tissue-entrypoint.sh index 49280f5..d4689db 100755 --- a/dist/bin/tissue-entrypoint.sh +++ b/dist/bin/tissue-entrypoint.sh @@ -3,6 +3,7 @@ set -e if [[ "$APP_DEBUG" == "true" ]]; then export PHP_INI_SCAN_DIR=":/usr/local/etc/php/php.d" + export PHP_XDEBUG_REMOTE_HOST=$(cat /etc/hosts | awk 'END{print $1}' | sed -r -e 's/[0-9]+$/1/g') fi exec docker-php-entrypoint "$@" diff --git a/dist/php.d/99-xdebug.ini b/dist/php.d/99-xdebug.ini index 007daa1..f2a7c9d 100644 --- a/dist/php.d/99-xdebug.ini +++ b/dist/php.d/99-xdebug.ini @@ -1,4 +1,4 @@ ; Dockerでのデバッグ用設定 zend_extension=xdebug.so xdebug.remote_enable=true -xdebug.remote_host=host.docker.internal \ No newline at end of file +xdebug.remote_host=${PHP_XDEBUG_REMOTE_HOST} \ No newline at end of file From 34df704fdbbb10cc9bef8840310a6c010208d04e Mon Sep 17 00:00:00 2001 From: shibafu Date: Tue, 19 Mar 2019 00:35:23 +0900 Subject: [PATCH 2/3] =?UTF-8?q?host.docker.internal=E3=81=8C=E4=BD=BF?= =?UTF-8?q?=E3=81=88=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AF=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bin/tissue-entrypoint.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dist/bin/tissue-entrypoint.sh b/dist/bin/tissue-entrypoint.sh index d4689db..f17bcec 100755 --- a/dist/bin/tissue-entrypoint.sh +++ b/dist/bin/tissue-entrypoint.sh @@ -3,7 +3,15 @@ set -e if [[ "$APP_DEBUG" == "true" ]]; then export PHP_INI_SCAN_DIR=":/usr/local/etc/php/php.d" - export PHP_XDEBUG_REMOTE_HOST=$(cat /etc/hosts | awk 'END{print $1}' | sed -r -e 's/[0-9]+$/1/g') + + php -r "if (gethostbyname('host.docker.internal') === 'host.docker.internal') exit(1);" &> /dev/null + if [[ $? -eq 0 ]]; then + # Docker for Windows/Mac + export PHP_XDEBUG_REMOTE_HOST='host.docker.internal' + else + # Docker for Linux + export PHP_XDEBUG_REMOTE_HOST=$(cat /etc/hosts | awk 'END{print $1}' | sed -r -e 's/[0-9]+$/1/g') + fi fi exec docker-php-entrypoint "$@" From a7859fdda6e0b4627ded5a27ee85ae2dc61a069a Mon Sep 17 00:00:00 2001 From: shibafu Date: Tue, 19 Mar 2019 00:56:31 +0900 Subject: [PATCH 3/3] =?UTF-8?q?set=20-e=E3=81=97=E3=81=A6=E3=82=8B?= =?UTF-8?q?=E3=82=93=E3=81=A0=E3=81=8B=E3=82=89=E8=90=BD=E3=81=A1=E3=82=8B?= =?UTF-8?q?=E3=81=A0=E3=82=8D=E3=81=86=E3=81=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bin/tissue-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/bin/tissue-entrypoint.sh b/dist/bin/tissue-entrypoint.sh index f17bcec..5878f2f 100755 --- a/dist/bin/tissue-entrypoint.sh +++ b/dist/bin/tissue-entrypoint.sh @@ -4,7 +4,7 @@ set -e if [[ "$APP_DEBUG" == "true" ]]; then export PHP_INI_SCAN_DIR=":/usr/local/etc/php/php.d" - php -r "if (gethostbyname('host.docker.internal') === 'host.docker.internal') exit(1);" &> /dev/null + php -r "if (gethostbyname('host.docker.internal') === 'host.docker.internal') exit(1);" &> /dev/null && : if [[ $? -eq 0 ]]; then # Docker for Windows/Mac export PHP_XDEBUG_REMOTE_HOST='host.docker.internal'