Skip to content

Commit e80d65a

Browse files
committed
Change xdebug approach.
1 parent cc20f85 commit e80d65a

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
7171
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
7272

7373
RUN pecl install xdebug-2.7.0RC1
74-
RUN docker-php-ext-enable xdebug
75-
76-
# Xdebug settings.
77-
COPY ./xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
7874

7975
# Imagemagick.
8076
RUN apk add --no-cache imagemagick-dev
@@ -92,6 +88,9 @@ ENV PATH=$PATH:$GOPATH/bin
9288
RUN go get github.com/mailhog/mhsendmail
9389
RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
9490
COPY ./php.ini /usr/local/etc/php/conf.d/docker-php.ini
91+
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
92+
COPY docker-php-entrypoint /usr/local/bin/
93+
COPY set-permissions /usr/local/bin/
9594

9695
# Fix iconv lib
9796
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing gnu-libiconv

docker-php-entrypoint

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
if [ "${1#-}" != "$1" ]; then
6+
set -- php-fpm "$@"
7+
fi
8+
9+
# Set permissions
10+
/usr/local/bin/set-permissions&
11+
12+
# If enviorment variable is set for XDebug to be enabled then enable it
13+
if [ "$XDEBUG_ENABLE" = "enable" ] ; then
14+
docker-php-ext-enable xdebug
15+
fi
16+
17+
exec "$@"

set-permissions

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
set -e
3+
APP_DOCKER_DIR=/var/www/html
4+
HOST_OSTYPE=${HOST_OSTYPE-linux}
5+
APP_DOCROOT=web
6+
PRIVATE_DIR=${PRIVATE_DIR-sites/default/files/private}
7+
8+
# Make directory if it doesn't exist
9+
mkdir -p "$APP_DOCKER_DIR/$APP_DOCROOT/sites/default/files"
10+
11+
chmod -R g+w "$APP_DOCKER_DIR/$APP_DOCROOT/sites/default/files"
12+
find "$APP_DOCKER_DIR/$APP_DOCROOT/sites/default/files" -type d -print0 | xargs -0 chmod g+s
13+
14+
if [ -d "$APP_DOCKER_DIR/$APP_DOCROOT/$PRIVATE_DIR" ]; then
15+
chmod -R g+w "$APP_DOCKER_DIR/$APP_DOCROOT/$PRIVATE_DIR"
16+
find "$APP_DOCKER_DIR/$APP_DOCROOT/$PRIVATE_DIR" -type d -print0 | xargs -0 chmod g+s
17+
else
18+
echo "No private directory found"
19+
fi

xdebug.ini

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
2-
xdebug.coverage_enable=0
31
xdebug.remote_enable=1
4-
xdebug.remote_connect_back=1
5-
xdebug.remote_log=/tmp/xdebug.log
6-
xdebug.remote_autostart=true
2+
xdebug.remote_handler=dbgp
3+
xdebug.remote_port=9000
4+
xdebug.remote_connect_back=0
5+
xdebug.idekey=PHPSTORM
6+
xdebug.remote_host=host.docker.internal
7+
xdebug.remote_mode=req
8+
xdebug.remote_autostart=0
9+
xdebug.remote_log="/tmp/xdebug.log"
10+
xdebug.max_nesting_level=1000

0 commit comments

Comments
 (0)