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
|
@ -0,0 +1 @@
|
|||
/logs
|
|
@ -0,0 +1,5 @@
|
|||
FROM debian:jessie
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
CMD ["true"]
|
|
@ -1,58 +1,65 @@
|
|||
# PHP + NGINX Container #----------------------------------
|
||||
php-nginx:
|
||||
image: laradock/php56nginx:0.1.0
|
||||
container_name: php-nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./settings/nginx:/etc/nginx/sites-available
|
||||
- ../:/var/www
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
links:
|
||||
- mysql
|
||||
- redis
|
||||
privileged: true
|
||||
version: '2'
|
||||
services:
|
||||
|
||||
# MySQL Container #----------------------------------------
|
||||
mysql:
|
||||
image: laradock/mysql:0.1.0
|
||||
container_name: mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes_from:
|
||||
- data
|
||||
environment:
|
||||
MYSQL_DATABASE: homestead
|
||||
MYSQL_USER: homestead
|
||||
MYSQL_PASSWORD: secret
|
||||
privileged: true
|
||||
### Nginx Server Container ##################################
|
||||
|
||||
# Redis Container #----------------------------------------
|
||||
redis:
|
||||
image: laradock/redis:0.1.0
|
||||
container_name: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes_from:
|
||||
- data
|
||||
volumes:
|
||||
- ./logs/redis:/var/log/redis
|
||||
privileged: true
|
||||
nginx:
|
||||
build: ./nginx
|
||||
container_name: nginx
|
||||
volumes_from:
|
||||
- php
|
||||
volumes:
|
||||
- ./logs/nginx/:/var/log/nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
links:
|
||||
- php
|
||||
|
||||
# Data Volume Container #----------------------------------
|
||||
data:
|
||||
image: laradock/data:0.1.0
|
||||
container_name: data
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- /var/lib/redis
|
||||
### PHP Container ###########################################
|
||||
|
||||
# Beanstalkd Container #-----------------------------------
|
||||
# beanstalkd:
|
||||
# image: laradock/beanstalkd:0.1.0
|
||||
# container_name: beanstalkd
|
||||
# ports:
|
||||
# - "11300:11300"
|
||||
# privileged: true
|
||||
php:
|
||||
build: ./php
|
||||
container_name: php
|
||||
volumes:
|
||||
- ../:/var/www/laravel
|
||||
- ./logs/php/:/usr/local/var/log
|
||||
expose:
|
||||
- "9000"
|
||||
links:
|
||||
- mysql
|
||||
|
||||
#----------------------------------------------------------
|
||||
### MySQL Container #########################################
|
||||
|
||||
mysql:
|
||||
build: ./mysql
|
||||
container_name: mysql
|
||||
volumes_from:
|
||||
- data
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
MYSQL_DATABASE: homestead
|
||||
MYSQL_USER: homestead
|
||||
MYSQL_PASSWORD: secret
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
|
||||
### Redis Container #########################################
|
||||
|
||||
redis:
|
||||
build: ./redis
|
||||
container_name: redis
|
||||
volumes_from:
|
||||
- data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
### DATA Container ##########################################
|
||||
|
||||
data:
|
||||
build: ./data
|
||||
container_name: data
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- /var/lib/redis
|
||||
|
||||
### Add more Containers below ###############################
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
FROM mysql:latest
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
VOLUME /var/lib/mysql
|
||||
|
||||
CMD ["mysqld"]
|
||||
|
||||
EXPOSE 3306
|
|
@ -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 ipv6only=on;
|
||||
|
||||
root /var/www/public;
|
||||
root /var/www/laravel/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
|
@ -11,7 +11,7 @@ server {
|
|||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
@ -21,3 +21,6 @@ server {
|
|||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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;
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
date.timezone = UTC
|
||||
display_errors = Off
|
||||
log_errors = On
|
|
@ -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
|
|
@ -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