Skip to content

Instantly share code, notes, and snippets.

@s-belichenko
Last active February 20, 2020 08:43
Show Gist options
  • Save s-belichenko/df254b2787225b81b7736037d38fa80e to your computer and use it in GitHub Desktop.
Save s-belichenko/df254b2787225b81b7736037d38fa80e to your computer and use it in GitHub Desktop.
Docker files for xdebug (alpine, nginx)
##
## Конфигурация docker-compose для локальной разработки.
##
version: '3'
services:
##
## Разрабатываемое приложение.
##
some_project:
build:
context: '.'
dockerfile: 'Dockerfile.local'
environment:
PHP_IDE_CONFIG: 'serverName=some-project.local'
RUN apt update \
&& apt -y install gcc make autoconf \
&& mkdir ~/xdebug \
&& cd ~/xdebug \
&& wget http://xdebug.org/files/xdebug-2.7.2.tgz \
&& tar -xvzf xdebug-2.7.2.tgz \
&& cd xdebug-2.7.2 \
&& phpize \
&& ./configure \
&& make \
&& cp modules/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20180731 \
&& echo 'zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so' >> /usr/local/etc/php/php.ini \
&& echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini \
&& echo 'xdebug.remote_autostart=1' >> /usr/local/etc/php/php.ini \
&& echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini \
&& echo 'xdebug.remote_host="172.16.8.x"' >> /usr/local/etc/php/php.ini \
&& echo 'xdebug.remote_port="9000"' >> /usr/local/etc/php/php.ini \
&& service nginx restart
RUN apt update && apt install mc iputils-ping procps -y
apt update && apt install mc iputils-ping procps -y; \
echo "xdebug.remote_host = 192.168.56.1" > '/usr/local/etc/php/conf.d/php.external.ini'; \
echo "xdebug.remote_autostart = 1" >> '/usr/local/etc/php/conf.d/xdebug.ini'; \
pkill -o -USR2 php-fpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment