Skip to content

Instantly share code, notes, and snippets.

@luxifer
Created June 5, 2016 08:49
Show Gist options
  • Save luxifer/aaffe7af3cc498c5677b44457f070282 to your computer and use it in GitHub Desktop.
Save luxifer/aaffe7af3cc498c5677b44457f070282 to your computer and use it in GitHub Desktop.
Thelia with docker-compose v2

Run docker-compose up -d --build and head to localhost:8080

version: '2'
services:
web:
build: ./docker/nginx
volumes:
- .:/var/www/html:ro
links:
- php
ports:
- "8080:80"
php:
build: ./docker/php
volumes:
- .:/var/www/html
links:
- db
environment:
SYMFONY_ENV: dev
db:
image: mariadb
volumes:
- /var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_DATABASE: thelia
FROM nginx:stable
COPY vhost.conf /etc/nginx/conf.d/default.conf
FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu-dev \
git \
zip \
libzip-dev \
&& docker-php-ext-install intl pdo_mysql mcrypt mbstring zip calendar \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug
COPY php.ini /usr/local/etc/php/php.ini
date.timezone = Europe/Paris
post_max_size = 20M
server {
listen 80;
server_name _;
root /var/www/html/web/;
index index.php;
location / {
try_files $uri $uri/ @rewriteapp;
}
location @rewriteapp {
# rewrite all to index.php
rewrite ^(.*)$ /index.php/$1 last;
}
# Php configuration
location ~ ^/(index|index_dev)\.php(/|$) {
# Php-FPM Config (Socks or Network)
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# This rule is just needed if you want to use the web installer
# in production you have to remove this
# and also remove the "install" directory in the "web" directory
location /install/ {
alias /var/www/html/web/install/;
location ~ ^/install/.+\.(jpg|jpeg|gif|css|png|js|pdf|zip)$ {
expires 30d;
access_log off;
log_not_found off;
}
location ~ ^/install/(.+\.php)$ {
alias /var/www/html/web/install/$1;
# Php-FPM Config (Socks or Network)
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
# Security. discard all files and folders starting with a "."
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Stuffs
location = /favicon.ico {
allow all;
access_log off;
log_not_found off;
}
location ~ /robots.txt {
allow all;
access_log off;
log_not_found off;
}
# Static files
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|pdf|zip)$ {
expires 30d;
access_log off;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment