Browse Source

- turn off restart workspace container option after start|stop xdebug

master
dimti 3 years ago
parent
commit
b10442065d
  1. 54
      dockerfiles/workspace/xdebug.sh

54
dockerfiles/workspace/xdebug.sh

@ -12,26 +12,11 @@ if [[ -z "${WORKSPACE_CONTAINER}" ]]; then
exit 1
fi
# Grab OS type
if [[ "$(uname)" == "Darwin" ]]; then
OS_TYPE="OSX"
else
OS_TYPE=$(expr substr $(uname -s) 1 5)
fi
xdebug_status ()
{
echo 'xDebug status'
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
}
@ -40,21 +25,13 @@ xdebug_start ()
echo 'Start xDebug'
# And uncomment line with xdebug extension, thus enabling it
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' \
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker restart $WORKSPACE_CONTAINER
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker restart $WORKSPACE_CONTAINER
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
echo 'In cli use this for resolve hostname for debugger in your IDE :'
echo 'export PHP_IDE_CONFIG="serverName=loc.mydomain.ru"'
}
@ -65,23 +42,8 @@ xdebug_stop ()
# Comment out xdebug extension line
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
# If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then
# This is the equivalent of:
# winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
# Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593
winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
docker restart $WORKSPACE_CONTAINER
#docker-compose restart php-fpm
winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
else
docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
# docker-compose restart php-fpm
docker restart $WORKSPACE_CONTAINER
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
fi
docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
}

Loading…
Cancel
Save