diff --git a/.docker/php-fpm/7.1/Dockerfile b/.docker/php-fpm/7.1/Dockerfile index f736515..a84166e 100644 --- a/.docker/php-fpm/7.1/Dockerfile +++ b/.docker/php-fpm/7.1/Dockerfile @@ -10,6 +10,7 @@ RUN apt-get update -qq \ && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \ + && echo "xdebug.remote_host=XDEBUG_REMOTE_HOST" >> /usr/local/etc/php/conf.d/xdebug.ini \ && docker-php-ext-install -j$(nproc) pdo pdo_pgsql zip bcmath mbstring xml curl \ && curl -sS http://getcomposer.org/installer | php -- --filename=composer \ && chmod a+x composer \ diff --git a/.docker/php-fpm/7.1/config/entrypoint.sh b/.docker/php-fpm/7.1/config/entrypoint.sh index 904ad97..0e27ae7 100644 --- a/.docker/php-fpm/7.1/config/entrypoint.sh +++ b/.docker/php-fpm/7.1/config/entrypoint.sh @@ -7,18 +7,25 @@ shopt -s nocasematch if [ -z ${TZ+x} ]; then echo "Warning : TimeZone is unset !"; else - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ; + sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ | sudo tee /etc/timezone ; fi +if [ $XDEBUG_ENABLE == "true" ]; then + sudo sed -i "s#XDEBUG_REMOTE_HOST#$(ip r | awk '/default/{print $3}')#" /usr/local/etc/php/conf.d/xdebug.ini +else + echo "XDebug disabled"; +fi + +if [ $REMOTE_HOST_ENABLE == "true" ]; then + if ! grep -Fxq "remote_host" /etc/hosts; then + echo "$(ip r | awk '/default/{print $3}') remote_host" | sudo tee --append /etc/hosts + fi; +else + echo "remote host disabled"; +fi # Starting the custom entrypointf it exists if [ -f /docker/custom-entrypoint.sh ]; then source /config/custom-entrypoint.sh fi -# Moving static files to a sharedVolume with the nginx -rm -rf /nginx/* -if [ -d "/var/www/html/public" ]; then - cp -rf /var/www/html/public /nginx -fi - exec "$@" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 3e88ca8..b41d39e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,8 @@ services: restart: "${RESTART_POLICIES}" environment: TZ: ${TIMEZONE} - XDEBUG_CONFIG: remote_host=${REMOTE_HOST} + XDEBUG_ENABLE: "true" + REMOTE_HOST_ENABLE: "true" SSH_AUTH_SOCK: /ssh-agent DB_USER: ${DB_USER} DB_PASSWORD: ${DB_PASSWORD} @@ -44,8 +45,6 @@ services: - $SSH_AUTH_SOCK:/ssh-agent working_dir: /var/www/html user: "${DOCKER_USER}" - entrypoint: - - "" command: - "php-fpm" networks: