Releases: ZK9XW3/symfony-docker-stack
Releases · ZK9XW3/symfony-docker-stack
Php Apache Mysql PhpMyAdmin Stack - ready for new Symfony project
Dockerized stack ready for a new Symfony project
Stack : php-apache2 mysql pma
Requirements :
- Ubuntu 20.04 or higher
- docker and docker-compose (optionnal: docker desktop)
- an IDE (phpStorm, Vscode or else)
- Make on your local machine if you want to use the Makefile commands (optionnal)
- git (optionnal but better)
How to set a new project
Prepare
git clonethis project- rename the main folder to your project name
mv symfony-stack your-project-name
- copy the .env.template file to .env and set the variables (Ports, project name, etc)
- Set your php version/image in the Dockerfile
FROM php:8.3-apache
Build
docker-compose up --buildORmake buildto build the containers
Install Symfony
- once the containers are up and running install Symfony :
- access your php-apache container
docker exec -it php-container-id-or-name bashORmake phpcomposer create-project symfony/skeleton:"7.1.*" .
- access your php-apache container
- If you are building a microservice or console app or API you're good to go.
- If you need the packages for a webApp :
composer require webapp
Change the owner
-
access your php container
docker exec -it php-container-id-or-name bashORmake php- go to var
cd /var
- change the owner of the www folder
chown -R www-data:www-data www
-
If you can't create a file on your local machine :
- You might need to change the owner of your backend directory on your local machine too
sudo chown -R $USER:$USER backend
- You might need to change the owner of your backend directory on your local machine too
Good to go ?
-
check
localhost:8080to see your app running orlocalhost:PHP_APACHE_HOST_PORTyou have set in the .env file -
check
localhost:8088to see your phpmyadmin orlocalhost:PMA_HOST_PORTyou have set in the .env file -
your database is running on port
3308orMYSQL_PORTyou have set in the .env file -
At this point your containers should be running fine. You're ready to go 🚀!
-
If something is wrong check your docker logs