Skip to content

Commit 0790d91

Browse files
author
Vincent Faliès
committed
Update .gitignore for apache vhosts
Update documentation Add multiple profiles for PHP/Web server configuration Bug fixed aliases
1 parent c6bba0e commit 0790d91

12 files changed

+144
-66
lines changed

.bash_aliases

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
alias composer='docker run -ti --rm -v $(pwd):/app composer/composer'
1+
alias composer='docker run -ti --rm -v $(pwd):/var/www/html composer/composer'
22
alias php='docker exec -ti dev_web_1 php'
3-
alias bower='docker run -ti --rm -v $(pwd):/data digitallyseamless/nodejs-bower-grunt bower'
4-
alias nodejs='docker run -ti --rm -v $(pwd):/data digitallyseamless/nodejs-bower-grunt nodejs'
5-
alias npm='docker run -ti --rm -v $(pwd):/data digitallyseamless/nodejs-bower-grunt npm'
6-
alias grunt='docker run -ti --rm -v $(pwd):/data digitallyseamless/nodejs-bower-grunt grunt'
3+
alias bower='docker run -ti --rm -v $(pwd):/var/www/html digitallyseamless/nodejs-bower-grunt bower'
4+
alias nodejs='docker run -ti --rm -v $(pwd):/var/www/html digitallyseamless/nodejs-bower-grunt nodejs'
5+
alias grunt='docker run -ti --rm -v $(pwd):/var/www/html digitallyseamless/nodejs-bower-grunt grunt'

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
projects/*
22
!projects/phpinfo.php
33
conf/apache/vhosts/*
4-
conf/nginx/*
5-
!conf/apache/vhosts/000-default.conf
6-
!conf/nginx/default.conf
4+
!conf/apache/vhosts/000-default.php
75
db/mysql/*

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ Plusieurs scripts sont a disposition pour facilité l'utilisation courante des c
2222

2323
Lance le build, puis le démarrage de l'environnement de développement.
2424

25+
Par défaut, le profile PHP 7 FPM avec Nginx est lancé. Pour visualiser les profiles possibles, lancer la commande suivante :
26+
27+
```
28+
./start.sh help
29+
```
30+
2531
- stop.sh
2632

2733
Arrête l'ensemble des containers et les supprime.

docker-compose.yml

+3-52
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,6 @@
11
# Environnement Web de developpement en PHP 7.0.13 avec Apache
22
version: '2'
33
services:
4-
5-
# Web Server PHP 7 + Apache 2
6-
web:
7-
restart: always
8-
build: docker/php7apache
9-
container_name: web
10-
ports:
11-
- "81:80" # Redirection des portes entre l'hote et Docker
12-
volumes:
13-
- ./projects:/var/www/html
14-
- ./conf/apache/vhosts:/etc/apache2/sites-enabled # Emplacement de VHOST Apache
15-
- ./conf/php/php.ini:/usr/local/etc/php/conf.d/30-custom.ini # PHP ini custom
16-
environment:
17-
- ALLOW_OVERRIDE=true
18-
links:
19-
- db:db
20-
- maildev:maildev
21-
22-
# # Web Server NGinx
23-
# web:
24-
# image: nginx
25-
# ports:
26-
# - "81:80"
27-
# container_name: web
28-
# volumes:
29-
# - ./conf/nginx:/etc/nginx/conf.d
30-
# - ./projects:/var/www/html
31-
# links:
32-
# - php:php
33-
#
34-
# # PHP 7.0.13 FPM
35-
# php:
36-
# build: docker/php7fpm
37-
# container_name: php
38-
# volumes:
39-
# - ./projects:/var/www/html
40-
# - ./conf/php/php.ini:/usr/local/etc/php/php.ini
41-
# links:
42-
# - db:db
43-
# - maildev:maildev
44-
45-
# PHP 5.6 FPM
46-
# php:
47-
# build: docker/php5.6fpm
48-
# container_name: php
49-
# volumes:
50-
# - ./projects:/var/www/html
51-
# - ./conf/php/php.ini:/usr/local/etc/php/php.ini
52-
# links:
53-
# - db:db
54-
# - maildev:maildev
55-
564
# Database MySQL
575
db:
586
restart: always
@@ -66,6 +14,7 @@ services:
6614
# To create email during devloppement
6715
maildev:
6816
restart: always
17+
container_name: maildev
6918
image: djfarrelly/maildev
7019
container_name: maildev
7120
ports:
@@ -75,11 +24,13 @@ services:
7524
composer:
7625
restart: always
7726
image: composer/composer
27+
container_name: composer
7828

7929
# Node / Bower / Grunt
8030
nodejs-grunt-bower:
8131
restart: always
8232
image: digitallyseamless/nodejs-bower-grunt
33+
container_name: nodejs-bower-grunt
8334

8435
# PhpMyAdmin
8536
phpmyadmin:

docker/nginx/Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM nginx
2+
MAINTAINER Vincent Falies <vincent.falies@gmail.com>
3+
4+
RUN apt-get update \
5+
&& apt-get install curl
6+
7+
ADD start.sh /usr/local/bin/start.sh
8+
RUN chmod +x /usr/local/bin/start.sh
9+
10+
CMD ["/usr/local/bin/start.sh"]

docker/nginx/docker-compose.nginx.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '2'
2+
services:
3+
# Web Server NGinx
4+
web:
5+
image: nginx
6+
ports:
7+
- "81:80"
8+
container_name: web
9+
volumes:
10+
- ./conf/nginx:/etc/nginx/conf.d
11+
- ./projects:/var/www/html
12+
links:
13+
- php:php

docker/nginx/start.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
/etc/init.d/nginx start
4+
/etc/init.d/filebeat start
5+
6+
tail -f /var/log/nginx/access.log -f /var/log/nginx/error.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '2'
2+
services:
3+
# PHP 5.6 FPM
4+
php:
5+
build: docker/php5.6fpm
6+
container_name: php
7+
volumes:
8+
- ./projects:/var/www/html
9+
- ./conf/php/php.ini:/usr/local/etc/php/php.ini
10+
links:
11+
- db:db
12+
- maildev:maildev
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '2'
2+
services:
3+
# Web Server PHP 7 + Apache 2
4+
web:
5+
restart: always
6+
build: docker/php7apache
7+
container_name: web
8+
ports:
9+
- "81:80" # Redirection des portes entre l'hote et Docker
10+
volumes:
11+
- ./projects:/var/www/html
12+
- ./conf/apache/vhosts:/etc/apache2/sites-enabled # Emplacement de VHOST Apache
13+
- ./conf/php/php.ini:/usr/local/etc/php/conf.d/30-custom.ini # PHP ini custom
14+
environment:
15+
- ALLOW_OVERRIDE=true
16+
links:
17+
- db:db
18+
- maildev:maildev
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '2'
2+
services:
3+
# PHP 7.0.13 FPM
4+
php:
5+
build: docker/php7fpm
6+
container_name: php
7+
volumes:
8+
- ./projects:/var/www/html
9+
- ./conf/php/php.ini:/usr/local/etc/php/php.ini
10+
links:
11+
- db:db
12+
- maildev:maildev

start.sh

+57-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,61 @@
11
#!/bin/bash
22

3-
echo Démarrage des containers...
3+
# Default profile
4+
default='php7nginx'
45

5-
docker-compose down
6-
docker-compose up --build -d
6+
profile=''
7+
if [ -z $1 ]
8+
then
9+
profile=$default
10+
else
11+
profile=$1
12+
fi
713

8-
echo Containers démarrés
14+
echo Starting containers...
15+
16+
docker-compose down --remove-orphans
17+
18+
case $profile in
19+
'php7nginx')
20+
echo 'Profile: PHP 7.0 FPM with NGinx web server'
21+
docker-compose \
22+
-f docker-compose.yml \
23+
-f docker/nginx/docker-compose.nginx.yml \
24+
-f docker/php7fpm/docker-compose.php7fpm.yml \
25+
up --build -d
26+
;;
27+
'php7apache')
28+
echo 'Profile: PHP 7.0 module with Apache 2 web server'
29+
docker-compose \
30+
-f docker-compose.yml \
31+
-f docker/php7apache/docker-compose.php7apache.yml \
32+
up --build -d
33+
;;
34+
'php5.6nginx')
35+
echo 'Profile: PHP 5.6 FPM with NGinx web server'
36+
docker-compose \
37+
-f docker-compose.yml \
38+
-f docker/nginx/docker-compose.nginx.yml \
39+
-f docker/php5.6fpm/docker-compose.php5.6fpm.yml \
40+
up --build -d
41+
;;
42+
'help')
43+
echo 'Web development environment'
44+
echo ''
45+
echo 'Possible profiles :'
46+
echo ' - php7nginx : PHP 7.0 FPM with NGinx web server'
47+
echo ' - php7apache : PHP 7.0 module with Apache 2 web server'
48+
echo ' - php5.6nginx : PHP 5.6 FPM with NGinx web server'
49+
echo ''
50+
echo 'Usage : ./start.sh <profile name>'
51+
exit
52+
;;
53+
*)
54+
echo "Unknown profile $profile"
55+
echo ''
56+
echo 'Type "./start.sh help" for a list of available profiles'
57+
exit
58+
;;
59+
esac
60+
61+
echo Containers started

stop.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
echo Arrêt des containers...
44

5-
docker-compose down
5+
docker-compose down --remove-orphans
66

77
echo Containers arrétés
8-

0 commit comments

Comments
 (0)