docker-php
docker-php copied to clipboard
Docker compose to run Symfony application
docker-php
Docker compose to run PHP application, given Symfony configuration as an example.
Installation
- Create a
.envfrom.env.distfile, and customize it according to your preferences. - Update your hosts file according to the NGINX server configuration
# UNIX
sudo echo "0.0.0.0 lekode.dev" >> /etc/hosts
# Windows (edit C:\Windows\System32\drivers\etc\hosts)
- Build containers
docker-compose build
Usage
After building the containers, just run them and you’re ready to go
docker-compose up -d
Utils
Here is a list of things that can help you
xDebug
- [x] TODO: How to configure xDebug with a code editor. (an article that explain how to use it with your IDE.)
Customize containers for different environment
- [x] TODO: Add other useful containers (Redis, phpMyAdmin …)
- [ ] TODO: Customize NGINX for other frameworks than Symfony (Add .conf file per framework)
Execute commands inside containers
You may need to execute commands inside php-fpm container to clear Symfony cache, install fixtures or whatever, to do this, check your container name from running containers list, connect to your container, and execute your command
docker ps
docker exec -ti lekode.lab.php sh
php bin/console ...
Contributing
First, many thanks for your contributions, please note that this eco system is a personal preference that I use in most of my PHP projects (using Symfony or other frameworks), if you find any typo/misconfiguration, or just want to optimize more the workflow, please
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
History
TODO: Write history
License
This project is licensed under the MIT License - see the LICENSE file for details