Skip to content

Instantly share code, notes, and snippets.

@DennisdeBest
Created June 11, 2019 05:26
Show Gist options
  • Save DennisdeBest/325f2e1b1ef175f1d253d7093702b2ba to your computer and use it in GitHub Desktop.
Save DennisdeBest/325f2e1b1ef175f1d253d7093702b2ba to your computer and use it in GitHub Desktop.
# docker-compose.yml
version: '3.7'
networks:
default:
name: local
services:
mysql:
image: mysql:5.7
restart: on-failure
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE:
MYSQL_USER:
MYSQL_PASSWORD:
nepalFederatie:
image: nginx:1.15.3-alpine
restart: on-failure
volumes:
- './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
ports:
- '80:80'
depends_on:
- php
php:
build:
context: .
dockerfile: docker/php/Dockerfile
restart: on-failure
env_file:
- .env
user: 1000:1000
links:
- mysql
volumes:
- ./apps/nepalFederatie:/var/www/symfony:cached
# docker/php/Dockerfile
# ./docker/php/Dockerfile
FROM php:7.3-fpm
RUN docker-php-ext-install pdo_mysql
RUN pecl install apcu-5.1.11
RUN docker-php-ext-enable apcu
RUN yes | pecl install xdebug \
&& 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
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& mv composer /usr/local/bin/composer
WORKDIR /var/www/symfony
RUN ls
RUN PATH=$PATH:/usr/src/apps/vendor/bin:bin
# docker/nginx/default.conf
# ./docker/nginx/default.conf
server {
server_name ~.*;
location / {
root /var/www/symfony/public;
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
client_max_body_size 50m;
fastcgi_pass php:9000;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/symfony/public/index.php;
}
error_log /dev/stderr debug;
access_log /dev/stdout;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment