symfony-docker
symfony-docker copied to clipboard
This is a complete stack for running Symfony 6 with PHP-FPM 8.2 and MySQL 8 into Docker containers using docker-compose tool.
🐳 Docker + PHP 8.1 + MySQL + Nginx + Symfony 6.1 Boilerplate
Description
This is a complete stack for running Symfony 6.1 into Docker containers using docker-compose tool with docker-sync library.
It is composed by 4 containers:
nginx, acting as the webserver.php, the PHP-FPM container with the 8.0 version of PHP.dbwhich is the MySQL database container with a MySQL 8.0 image.symfony_docker_app_syncto sync files using librarydocker-sync.
Installation
-
😀 Clone this rep.
-
Create the file
./.docker/.env.nginx.localusing./.docker/.env.nginxas template. The value of the variableNGINX_BACKEND_DOMAINis theserver_nameused in NGINX. -
Go inside folder
./dockerand rundocker-sync-stack startto start containers. -
You should work inside the
phpcontainer. This project is configured to work with Remote Container extension for Visual Studio Code, so you could runReopen in containercommand after open the project. -
Inside the
phpcontainer, runcomposer installto install dependencies from/var/www/symfonyfolder. -
Use the following value for the DATABASE_URL environment variable:
DATABASE_URL=mysql://app_user:helloworld@db:3306/app_db?serverVersion=8.0.23
You could change the name, user and password of the database in the env file at the root of the project.
To learn more
I have recorded a Youtube session explaining the different parts of this project. You could see it here: