In some cases you or your team don't want to use many docker containers while development. Multisite docker
Checkout this repository
git clone https://github.com/mbunge/multi-site-docker.git
Up and running
docker-compose up -d engage
And stop it
docker-compose down
- Nginx
- PHP (FPM)
- MySQL
Designed for multi-site development.
Change path to your projects in docker-compose.yml
on line 40. Replace - ./sites:/var/www
with -../your-path:/var/www
Go to docker-compose.yml and change image
with your desired php-image. We prefer php fpm xdebug images provided by
prooph for development.
Go to sites/
and add a new folder mkdir -P sites/my-awesome-project/public
. public/
is the place for your
index.php
. Keep your host file in mind. The sites folder my-awesome-project
is mapped to domain. You need to add
my-awesome-project
to your hosts and your project will be available via http://my-awesome-project
.
Go to machine/nginx/sites-enabled
, copy site.conf.example
and write your custom config
If you use tools like SQuirreL, DataGrip, etc. you may want to connect to from host. The host is 127.0.0.1 by default.
Username, password an port are the same as configured in docker-compose.yml
.
Inside of your container the hostanme to MySQL is database, similar to the service name. Just execute following code and you are connected.
<?php
$db = new PDO(
'mysql:host=database;port=3306;dbname=agantty_app;charset=UTF8;',
'root',
'dev',
[
PDO::ATTR_PERSISTENT=>true
]
);
var_dump($db->query('SHOW TABLES')->fetchAll());
docker-compose exec nginx bash
docker-compose exec php bash
docker-compose exec database bash
docker-compose exec dataphp bash
For composer we recomment this awesome docker container which is executing composer in your desired PHP-Version.
This is very easy. Execute your commands from following pattern
docker-compose exec php php [param1] [param2] [paramN]
For example migrate database with artisan
docker-compose exec php php my-awesome-project/artisan migrate
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
Use the issue tracker and we will help you!
The MIT License (MIT). Please see License File for more information.