Skip to content

Commit d941d93

Browse files
committed
feat: init config
1 parent 6be2039 commit d941d93

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed

.docker/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM php:7.1-fpm
2+
3+
MAINTAINER Descamps Antoine <antoine.descamps@ineat-conseil.fr>
4+
5+
RUN apt-get update && apt-get install -y \
6+
libfreetype6-dev \
7+
libjpeg62-turbo-dev \
8+
libmcrypt-dev \
9+
libpng-dev \
10+
libicu-dev \
11+
libpq-dev \
12+
libxpm-dev \
13+
libvpx-dev \
14+
&& pecl install xdebug \
15+
&& docker-php-ext-enable xdebug \
16+
&& docker-php-ext-install -j$(nproc) mcrypt \
17+
&& docker-php-ext-install -j$(nproc) gd \
18+
&& docker-php-ext-install -j$(nproc) intl \
19+
&& docker-php-ext-install -j$(nproc) zip \
20+
&& docker-php-ext-install -j$(nproc) pgsql \
21+
&& docker-php-ext-install -j$(nproc) pdo_pgsql \
22+
&& docker-php-ext-install -j$(nproc) exif \
23+
&& docker-php-ext-configure gd \
24+
--with-freetype-dir=/usr/include/ \
25+
--with-jpeg-dir=/usr/include/ \
26+
--with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \
27+
--with-vpx-dir=/usr/lib/x86_64-linux-gnu/ \

.docker/conf/nginx/default.conf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Nginx configuration
2+
3+
server {
4+
listen 80 default_server;
5+
listen [::]:80 default_server;
6+
server_name localhost;
7+
8+
root /var/www/html/public;
9+
10+
location / {
11+
# try to serve file directly, fallback to index.php
12+
try_files $uri /index.php$is_args$args;
13+
}
14+
15+
location ~ ^/index\.php(/|$) {
16+
fastcgi_pass php:9000;
17+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
18+
include fastcgi_params;
19+
20+
# optionally set the value of the environment variables used in the application
21+
# fastcgi_param APP_ENV prod;
22+
# fastcgi_param APP_SECRET <app-secret-id>;
23+
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
24+
25+
# When you are using symlinks to link the document root to the
26+
# current version of your application, you should pass the real
27+
# application path instead of the path to the symlink to PHP
28+
# FPM.
29+
# Otherwise, PHP's OPcache may not properly detect changes to
30+
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
31+
# for more information).
32+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
33+
fastcgi_param DOCUMENT_ROOT $realpath_root;
34+
# Prevents URIs that include the front controller. This will 404:
35+
# http://domain.tld/index.php/some-path
36+
# Remove the internal directive to allow URIs like this
37+
internal;
38+
}
39+
40+
# return 404 for all other php files not matching the front controller
41+
# this prevents access to other php files you don't want to be accessible.
42+
location ~ \.php$ {
43+
return 404;
44+
}
45+
46+
error_log /var/log/nginx/project_error.log;
47+
access_log /var/log/nginx/project_access.log;
48+
}

.docker/conf/php/php.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
date.timezone = Europe/Paris
2+
3+
display_errors = 1
4+
error_reporting = E_ALL

.docker/conf/php/xdebug.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
xdebug.remote_enable = 1
2+
xdebug.remote_autostart = 1
3+
xdebug.remote_connect_back = 1
4+
xdebug.remote_idekey = PHPSTORM
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DB_NAME=dbname
2+
DB_USER=dbuser
3+
DB_PASSWORD=dbpwd

docker-compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3'
2+
services:
3+
web:
4+
image: nginx
5+
volumes:
6+
- ./.docker/conf/nginx/default.conf:/etc/nginx/conf.d/default.conf
7+
- .:/var/www/html
8+
ports:
9+
- 80:80
10+
restart: always
11+
depends_on:
12+
- php
13+
- db
14+
php:
15+
build: .docker
16+
restart: always
17+
volumes:
18+
- ./.docker/conf/php/php.ini:/usr/local/etc/php/conf.d/php.ini
19+
- ./.docker/conf/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
20+
- .:/var/www/html
21+
composer:
22+
image: composer
23+
volumes:
24+
- .:/app
25+
command: install
26+
db:
27+
image: postgres:10.1
28+
restart: always
29+
environment:
30+
- POSTGRES_DB=${DB_NAME}
31+
- POSTGRES_USER=${DB_USER}
32+
- POSTGRES_PASSWORD=${DB_PASSWORD}
33+
ports:
34+
- 5432:5432
35+
volumes:
36+
- ./.docker/conf/postgres/:/docker-entrypoint-initdb.d/

0 commit comments

Comments
 (0)