Major updates.
- upgrade docker compose to v2 - build images locally instead of pulling them from the registry - separate php container form nginx container - support all the php versions including php 7.0 - remove beanstalked container to be optionally added later by the user
This commit is contained in:
parent
12051834a3
commit
05a83d383f
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/logs
|
5
data/Dockerfile
Normal file
5
data/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
CMD ["true"]
|
@ -1,58 +1,65 @@
|
|||||||
# PHP + NGINX Container #----------------------------------
|
version: '2'
|
||||||
php-nginx:
|
services:
|
||||||
image: laradock/php56nginx:0.1.0
|
|
||||||
container_name: php-nginx
|
### Nginx Server Container ##################################
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
build: ./nginx
|
||||||
|
container_name: nginx
|
||||||
|
volumes_from:
|
||||||
|
- php
|
||||||
|
volumes:
|
||||||
|
- ./logs/nginx/:/var/log/nginx
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
|
links:
|
||||||
|
- php
|
||||||
|
|
||||||
|
### PHP Container ###########################################
|
||||||
|
|
||||||
|
php:
|
||||||
|
build: ./php
|
||||||
|
container_name: php
|
||||||
volumes:
|
volumes:
|
||||||
- ./settings/nginx:/etc/nginx/sites-available
|
- ../:/var/www/laravel
|
||||||
- ../:/var/www
|
- ./logs/php/:/usr/local/var/log
|
||||||
- ./logs/nginx:/var/log/nginx
|
expose:
|
||||||
|
- "9000"
|
||||||
links:
|
links:
|
||||||
- mysql
|
- mysql
|
||||||
- redis
|
|
||||||
privileged: true
|
|
||||||
|
|
||||||
# MySQL Container #----------------------------------------
|
### MySQL Container #########################################
|
||||||
mysql:
|
|
||||||
image: laradock/mysql:0.1.0
|
mysql:
|
||||||
|
build: ./mysql
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- data
|
- data
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: homestead
|
MYSQL_DATABASE: homestead
|
||||||
MYSQL_USER: homestead
|
MYSQL_USER: homestead
|
||||||
MYSQL_PASSWORD: secret
|
MYSQL_PASSWORD: secret
|
||||||
privileged: true
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
|
||||||
# Redis Container #----------------------------------------
|
### Redis Container #########################################
|
||||||
redis:
|
|
||||||
image: laradock/redis:0.1.0
|
redis:
|
||||||
|
build: ./redis
|
||||||
container_name: redis
|
container_name: redis
|
||||||
ports:
|
|
||||||
- "6379:6379"
|
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- data
|
- data
|
||||||
volumes:
|
ports:
|
||||||
- ./logs/redis:/var/log/redis
|
- "6379:6379"
|
||||||
privileged: true
|
|
||||||
|
|
||||||
# Data Volume Container #----------------------------------
|
### DATA Container ##########################################
|
||||||
data:
|
|
||||||
image: laradock/data:0.1.0
|
data:
|
||||||
|
build: ./data
|
||||||
container_name: data
|
container_name: data
|
||||||
volumes:
|
volumes:
|
||||||
- /var/lib/mysql
|
- /var/lib/mysql
|
||||||
- /var/lib/redis
|
- /var/lib/redis
|
||||||
|
|
||||||
# Beanstalkd Container #-----------------------------------
|
### Add more Containers below ###############################
|
||||||
# beanstalkd:
|
|
||||||
# image: laradock/beanstalkd:0.1.0
|
|
||||||
# container_name: beanstalkd
|
|
||||||
# ports:
|
|
||||||
# - "11300:11300"
|
|
||||||
# privileged: true
|
|
||||||
|
|
||||||
#----------------------------------------------------------
|
|
||||||
|
9
mysql/Dockerfile
Normal file
9
mysql/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM mysql:latest
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
VOLUME /var/lib/mysql
|
||||||
|
|
||||||
|
CMD ["mysqld"]
|
||||||
|
|
||||||
|
EXPOSE 3306
|
14
nginx/Dockerfile
Normal file
14
nginx/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM nginx:latest
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
ADD nginx.conf /etc/nginx/
|
||||||
|
ADD laravel.conf /etc/nginx/sites-available/
|
||||||
|
|
||||||
|
RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
|
||||||
|
|
||||||
|
RUN usermod -u 1000 www-data
|
||||||
|
|
||||||
|
CMD ["nginx"]
|
||||||
|
|
||||||
|
EXPOSE 80 443
|
@ -2,7 +2,7 @@ server {
|
|||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server ipv6only=on;
|
listen [::]:80 default_server ipv6only=on;
|
||||||
|
|
||||||
root /var/www/public;
|
root /var/www/laravel/public;
|
||||||
index index.php index.html index.htm;
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@ -11,7 +11,7 @@ server {
|
|||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri /index.php =404;
|
try_files $uri /index.php =404;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
fastcgi_pass php-upstream;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
@ -21,3 +21,6 @@ server {
|
|||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
29
nginx/nginx.conf
Normal file
29
nginx/nginx.conf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
user www-data;
|
||||||
|
worker_processes 4;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 2048;
|
||||||
|
multi_accept on;
|
||||||
|
use epoll;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
server_tokens off;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 15;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
access_log off;
|
||||||
|
error_log off;
|
||||||
|
gzip on;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-available/*;
|
||||||
|
open_file_cache max=100;
|
||||||
|
}
|
||||||
|
|
||||||
|
daemon off;
|
16
php/Dockerfile
Normal file
16
php/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM php:7.0-fpm
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
||||||
|
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||||
|
|
||||||
|
# Install extensions using the helper script provided by the base image
|
||||||
|
RUN docker-php-ext-install \
|
||||||
|
pdo_mysql
|
||||||
|
|
||||||
|
RUN usermod -u 1000 www-data
|
||||||
|
|
||||||
|
CMD ["php-fpm"]
|
||||||
|
|
||||||
|
EXPOSE 9000
|
3
php/laravel.ini
Normal file
3
php/laravel.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
date.timezone = UTC
|
||||||
|
display_errors = Off
|
||||||
|
log_errors = On
|
76
php/laravel.pool.conf
Normal file
76
php/laravel.pool.conf
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
; Unix user/group of processes
|
||||||
|
; Note: The user is mandatory. If the group is not set, the default user's group
|
||||||
|
; will be used.
|
||||||
|
user = www-data
|
||||||
|
group = www-data
|
||||||
|
|
||||||
|
; The address on which to accept FastCGI requests.
|
||||||
|
; Valid syntaxes are:
|
||||||
|
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
|
||||||
|
; a specific port;
|
||||||
|
; 'port' - to listen on a TCP socket to all addresses on a
|
||||||
|
; specific port;
|
||||||
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
listen = 0.0.0.0:9000
|
||||||
|
|
||||||
|
; Choose how the process manager will control the number of child processes.
|
||||||
|
; Possible Values:
|
||||||
|
; static - a fixed number (pm.max_children) of child processes;
|
||||||
|
; dynamic - the number of child processes are set dynamically based on the
|
||||||
|
; following directives. With this process management, there will be
|
||||||
|
; always at least 1 children.
|
||||||
|
; pm.max_children - the maximum number of children that can
|
||||||
|
; be alive at the same time.
|
||||||
|
; pm.start_servers - the number of children created on startup.
|
||||||
|
; pm.min_spare_servers - the minimum number of children in 'idle'
|
||||||
|
; state (waiting to process). If the number
|
||||||
|
; of 'idle' processes is less than this
|
||||||
|
; number then some children will be created.
|
||||||
|
; pm.max_spare_servers - the maximum number of children in 'idle'
|
||||||
|
; state (waiting to process). If the number
|
||||||
|
; of 'idle' processes is greater than this
|
||||||
|
; number then some children will be killed.
|
||||||
|
; ondemand - no children are created at startup. Children will be forked when
|
||||||
|
; new requests will connect. The following parameter are used:
|
||||||
|
; pm.max_children - the maximum number of children that
|
||||||
|
; can be alive at the same time.
|
||||||
|
; pm.process_idle_timeout - The number of seconds after which
|
||||||
|
; an idle process will be killed.
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
pm = dynamic
|
||||||
|
|
||||||
|
; The number of child processes to be created when pm is set to 'static' and the
|
||||||
|
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
||||||
|
; This value sets the limit on the number of simultaneous requests that will be
|
||||||
|
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
||||||
|
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
||||||
|
; CGI. The below defaults are based on a server without much resources. Don't
|
||||||
|
; forget to tweak pm.* to fit your needs.
|
||||||
|
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
pm.max_children = 20
|
||||||
|
|
||||||
|
; The number of child processes created on startup.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
|
||||||
|
pm.start_servers = 2
|
||||||
|
|
||||||
|
; The desired minimum number of idle server processes.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Note: Mandatory when pm is set to 'dynamic'
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
|
||||||
|
; The desired maximum number of idle server processes.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Note: Mandatory when pm is set to 'dynamic'
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
|
||||||
|
;---------------------
|
||||||
|
|
||||||
|
; Make specific Docker environment variables available to PHP
|
||||||
|
env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE
|
||||||
|
env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER
|
||||||
|
env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
9
redis/Dockerfile
Normal file
9
redis/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM redis:latest
|
||||||
|
|
||||||
|
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||||
|
|
||||||
|
#COPY redis.conf /usr/local/etc/redis/redis.conf
|
||||||
|
|
||||||
|
CMD [ "redis-server" ]
|
||||||
|
|
||||||
|
EXPOSE 6379
|
Loading…
Reference in New Issue
Block a user