This commit is contained in:
xinatorus 2020-05-15 22:37:17 +02:00
parent c3d8a211ed
commit ded8a698f0
5 changed files with 76 additions and 0 deletions

4
.env Normal file
View File

@ -0,0 +1,4 @@
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=dummy
MYSQL_USER=dummy
MYSQL_PASSWORD=dummy

37
docker-compose.yml Normal file
View File

@ -0,0 +1,37 @@
version: '3'
services:
php:
build:
context: ./docker/php
ports:
- 9000:9000
volumes:
- ./:/srv/www/api
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
nginx:
image: nginx:1.13.8
ports:
- 80:80
volumes:
- ./:/srv/www/api
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
mysql:
image: mysql:5.7
ports:
- 3306:3306
depends_on:
- php
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}

20
docker/nginx/default.conf Normal file
View File

@ -0,0 +1,20 @@
server {
listen 80 default_server;
server_name api.com www.api.com;
root /srv/www/api;
location ~ \.php$ {
try_files $uri =404;
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 PATH_INFO $fastcgi_path_info;
}
error_log /var/log/nginx/api_error.log;
access_log /var/log/nginx/api_access.log;
}

3
docker/php/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM php:7.2-fpm
RUN docker-php-ext-install mysqli

12
docker/php/www.conf Normal file
View File

@ -0,0 +1,12 @@
[www]
user = www-data
group = www-data
listen = nginx:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3