Set of Docker files to set up a development environment for PHP (Laravel in particular) with artisan and composer.
The environment uses nginx to serve files, MySQL as database, and Adminer to manage the database.
Note: Obviously, you need Docker installed. You also need docker-compose - Docker Desktop for Windows includes docker-compose.
-
Clone or download the repository
-
Place your project files in src folder. Make sure your "public" folder exists as src/public
-
Run the docker services:
$ docker-compose up -d
-
That's it! Your application is hosted and your services should now be accessible on the following urls:
- Web server:
localhost
orlocalhost:80
- Adminer:
localhost:9090
- Web server:
-
You can run composer and artisan commands like so:
$ docker-compose run composer install $ docker-compose run artisan migrate
- Take a look at
docker-compose.yml
and modify it to suit your configuration. - Make sure the database particulars in your .env matches those in
docker-compose.yml
- In particular, the database host name should be the name of the database's service, i.e.
db
. Docker services are named after their service name in the Docker network.
- In particular, the database host name should be the name of the database's service, i.e.
- The database is persisted in the database folder
- To use a different "public" folder, modify the root location in
nginx/default.conf
Licensed under the MIT license.