Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ nbproject/
# Vagrant
Vagrantfile
.vagrant

/docker-compose.override.yml
/data
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,42 @@ Vhost example
</Directory>
</VirtualHost>


Install with docker
===================

Requirements
------------

* docker
* docker-compose

Installation
------------

* Copier la configuration de docker-compose:
```
cp docker-compose.override.yml-dist docker-compose.override.yml
```
* Au besoin, modifier le fichier `docker-compose.override.yml` avec les ports que vous souhaitez utiliser.
* Copier la configuration de l'application:
```
cp app/config.php.dist app/config.php
```
* executer un `docker-compose up` pour lancer l'application.

Utilisation
-----------

* Executer des commandes:
```
./docker/bin/bash
```
* Accès à mysql
```
./docker/bin/mysql
```

Comment participer
==================

Expand Down
10 changes: 5 additions & 5 deletions app/config.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ $app['secret'] = 'change_me_im_not_secret';
// MySQL
$app['db.options'] = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'host' => 'db',
'dbname' => 'aperophp',
'user' => '',
'password' => '',
'user' => 'afup',
'password' => 'afup',
);
// *******

Expand All @@ -35,8 +35,8 @@ $app['db.options'] = array(
// @see http://silex.sensiolabs.org/doc/providers/swiftmailer.html#parameters
// SMTP Transport
$app['mail.options'] = array(
'host' => 'localhost',
'port' => '25',
'host' => 'mailcatcher',
'port' => '1025',
'username' => '',
'password' => '',
'encryption' => null,
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.override.yml-dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
db:
ports:
- "3406:3306"

apachephp:
ports:
- "9105:80"

mailcatcher:
ports:
- "1081:1080"
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
db:
build: ./docker/dockerfiles/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: afup
MYSQL_PASSWORD: afup
MYSQL_DATABASE: aperophp
volumes:
- ./data/mysql:/var/lib/mysql

apachephp:
build: ./docker/dockerfiles/apachephp
volumes:
- ./:/var/www/html
links:
- db
- mailcatcher

cliphp:
build: ./docker/dockerfiles/apachephp
volumes:
- ./:/var/www/html
links:
- db
- mailcatcher
command: "false"

mailcatcher:
image: schickling/mailcatcher
2 changes: 2 additions & 0 deletions docker/bin/bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker-compose run --rm cliphp /bin/bash
3 changes: 3 additions & 0 deletions docker/bin/mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker-compose run --rm db /opt/mysql

12 changes: 12 additions & 0 deletions docker/dockerfiles/apachephp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM php:5.4-apache

RUN echo "date.timezone=Europe/Paris" >> "/usr/local/etc/php/php.ini"
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mbstring
RUN a2enmod rewrite

RUN echo "Include sites-enabled/" >> /etc/apache2/apache2.conf
COPY apache.conf /etc/apache2/sites-available/000-default.conf
RUN ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf


8 changes: 8 additions & 0 deletions docker/dockerfiles/apachephp/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<VirtualHost *:80>
DocumentRoot /var/www/html/web
<Directory /var/www/html/web>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
</VirtualHost>
3 changes: 3 additions & 0 deletions docker/dockerfiles/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mysql:5.6.21
COPY my.cnf /etc/mysql/my.cnf
COPY mysql /opt/mysql
4 changes: 4 additions & 0 deletions docker/dockerfiles/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[mysqld]
skip-host-cache
skip-name-resolve
innodb_file_per_table=1
2 changes: 2 additions & 0 deletions docker/dockerfiles/mysql/mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
mysql --host=db --port=3306 -uroot -p$MYSQL_ROOT_PASSWORD --protocol=TCP $MYSQL_DATABASE -A