This is a boilerplate to be used only in local environment for quick containerization. Use at your own risk.
src
=> Main directory, where your project should be
config
=> Configuration directory for different services to be used in docker-compose.yml file
.env.example
=> Project global config file
init.sh
=> Init script for the entire app (NB: Only for first time use! It will override .env
if there's such file in project root)
docker-compose.yml
=> Main docker-compose config for local environment
- Clone the repository
- Copy/paste your Laravel project in
src
directory - this directory contents will be linked to containerizedapp
service. - Add execution rights to
init.sh
file - Run
./init.sh
to copy.env.example
to.env
which will be used by Docker to name containers properly. It will also launch the containers. - Compare the database credentials throughout mysql init sql file, project root
.env
and your Laravel app.env
- When all that is done, launch
http://localhost
to bless your eyes with your Laravel app.
For now, if you want to run any commands through appropriate containers, you have to prefix your commands with docker-compose exec [service] [command you want to run]
, for example, docker-compose exec app php artisan migrate
.
There's also an option to just go into container with bash
(or whatever shell the container posesses) and run commands you need, like docker-compose exec bash
and in container php artisan migrate
.
- Command delegator script for running commands within appropriate containers
- Global search/replace from project root .env file so that there doesn't have to be manual search & replace for all the values
- Look to see if something differs for containerizing Symfony projects