Docker running Nginx, PHP-FPM, MySQL and PHPMyAdmin.
THIS ENVIRONMENT SHOULD ONLY BE USED FOR DEVELOPMENT!
DO NOT USE IT IN PRODUCTION!
-
Download it :
$ git clone https://github.com/nanoninja/docker-nginx-php-mysql.git
-
Run :
$ docker-compose up -d
-
Open your favorite browser :
- http://localhost:8000
- https://localhost:3000 (HTTPS not configured by default)
- phpMyAdmin (user: dev, pass: dev)
├── README.md
├── bin
│ └── linux
│ └── clean.sh
├── data
│ └── db
│ ├── dumps
│ └── mysql
├── docker-compose.yml
├── etc
│ ├── nginx
│ │ └── default.conf
│ ├── php
│ │ └── php.ini
│ └── ssl
└── web
├── app
│ ├── composer.json
│ ├── phpunit.xml.dist
│ ├── src
│ │ └── Foo.php
│ └── test
│ ├── FooTest.php
│ └── bootstrap.php
└── public
└── index.php
<?php
$dsn = 'mysql:host=mysql;dbname=test;charset=utf8;port=3306';
$pdo = new PDO($dsn, 'dev', 'dev');
?>
$ docker run --rm -v $(pwd)/web/app:/app -v ~/.ssh:/root/.ssh composer/composer update
$ docker exec -it mysql bash
and
$ mysql -uroot -proot
$ docker exec mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql
or
$ docker exec mysql sh -c 'exec mysqldump dbname -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/dbname.sql
$ docker exec mysql sh -c 'exec mysqldump test -uroot -p"$MYSQL_ROOT_PASSWORD"' > $(pwd)/data/db/dumps/test.sql
-
Generate certificates
$ docker run --rm -v $(pwd)/etc/ssl:/certificates -e "SERVER=localhost" jacoelho/generate-certificate
-
Configure Nginx
Edit nginx file etc/nginx/default.conf and uncomment the server section.
# server { # ... # }
./web/app/vendor/apigen/apigen/bin/apigen generate -s web/app/src -d web/app/doc
$ ./bin/linux/clean.sh $(pwd)