Skip to content

Instantly share code, notes, and snippets.

@settermjd
Last active September 16, 2016 17:15
Show Gist options
  • Save settermjd/5d7eacb5143e1b379489412805868ffb to your computer and use it in GitHub Desktop.
Save settermjd/5d7eacb5143e1b379489412805868ffb to your computer and use it in GitHub Desktop.
Docker Compose configuration
server {
# Set the port to listen on and the server name
listen 80 default_server;
# Set the document root of the project
root /var/www/html/public;
# Set the directory index files
index index.php;
# Specify the default character set
charset utf-8;
# Setup the default location configuration
location / {
try_files $uri $uri/ /index.php;
}
# Specify the details of favicon.ico
location = /favicon.ico { access_log off; log_not_found off; }
# Specify the details of robots.txt
location = /robots.txt { access_log off; log_not_found off; }
# Specify the logging configuration
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile off;
client_max_body_size 100m;
# Specify what happens when PHP files are requested
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION_ENV development;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
# Specify what happens what .ht files are requested
location ~ /\.ht {
deny all;
}
}
version: '2'
volumes:
database_data:
driver: local
services:
nginx:
build: ./docker/nginx/
depends_on:
- php
links:
- php
ports:
- 8080:80
volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./logs/nginx/:/var/log/nginx
volumes_from:
- php
php:
build: ./docker/php/
expose:
- 9000
links:
- mysql:database-server
volumes:
- .:/var/www/html
- ./logs/symfony:/var/www/symfony/app/logs
elk:
build: ./docker/elk/
ports:
- 9292:9292
- 9200:9200
- 9998:9998
- 9999:9999/udp
mysql:
image: mysql:latest
expose:
- 3306
volumes:
- database_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
FROM interactivesolutions/zf-php-fpm:7.0
ENV PHP_MODULES /usr/local/lib/php/extensions/no-debug-non-zts-20151012/
ENV XDEBUG_CONFIG /usr/local/etc/php/conf.d/xdebug.ini
ENV XDEBUG_IDE_KEY PhpStorm
ENV XDEBUG_REMOTE_CONNECT_BACK 1
ENV XDEBUG_REMOTE_ENABLE true
ENV XDEBUG_REMOTE_HANDLER dbgp
ENV XDEBUG_REMOTE_PORT 9000
RUN docker-php-ext-install pdo_mysql \
&& docker-php-ext-install json
COPY ./errors.ini /usr/local/etc/php/conf.d/errors.ini
COPY ./www.conf /usr/local/etc/php-fpm.d/www.conf
RUN apt-get update \
&& apt-get --yes --force-yes install git \
&& apt-get --yes --force-yes install zip \
&& apt-get --yes --force-yes install unzip \
&& cd /opt && git clone git://github.com/xdebug/xdebug.git \
&& cd xdebug && phpize && ./configure --enable-xdebug && make && cp modules/xdebug.so $PHP_MODULES \
&& echo "zend_extension=${PHP_MODULES}xdebug.so" > $XDEBUG_CONFIG \
&& echo "xdebug.remote_enable=${XDEBUG_REMOTE_ENABLE}" >> $XDEBUG_CONFIG \
&& echo "xdebug.remote_host=${HOST_IP}" >> $XDEBUG_CONFIG \
&& echo "xdebug.remote_handler=${XDEBUG_REMOTE_HANDLER}" >> $XDEBUG_CONFIG \
&& echo "xdebug.remote_connect_back=${XDEBUG_REMOTE_CONNECT_BACK}" >> $XDEBUG_CONFIG \
&& echo "xdebug.idekey=${XDEBUG_IDE_KEY}" >> $XDEBUG_CONFIG \
&& echo "xdebug.remote_port=${XDEBUG_REMOTE_PORT}" >> $XDEBUG_CONFIG
log_errors = On
error_reporting = E_ALL
error_log = /var/www/html/php5-fpm.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment