This is a stack based on lightweight Linux Distributions for running the latest version of Symfony Framework into Docker containers using docker-compose
It was designed to be used with Symfony, but it can be used with any other PHP Framework
- nginx (proxy)
- php-fpm
- php-cli (composer)
- nginx (server)
- mysql (database)
- phpmyadmin (GUI for mysql)
- Move to the
.dockerdirectory, where thedocker-compose.ymlfile is located - Create the
.envfile, copying it from.env.example - Replace the default environment variables values on
.envfile - Replace
${PROJECT_NAME}for the real value of the project name onnginx/vhost.conf - Add entries to
/etc/hosts(host machine) file for the locals domains specified inVIRTUAL_HOSTvariables insidedocker-compose.yml127.0.0.1 admin.${PROJECT_NAME}.local phpmyadmin.${PROJECT_NAME}.local(replace${PROJECT_NAME}with the real value)
- Run
docker-compose up -d
- Move to the
.dockerdirectory, where thedocker-compose.ymlfile is located - Run once
$ docker-compose run --rm php-cli composer create-project symfony/website-skeleton symfony - Go to the parent directory of
.docker - Run once
$ mv symfony/{.[!.],}* . ; rm -rf symfony - You can visit:
http://admin.${PROJECT_NAME}.localhttp://phpmyadmin.${PROJECT_NAME}.local
If you wanna to install other dependencies with composer, run the following
- Move to the
.dockerdirectory, where thedocker-compose.ymlfile is located - Install any needed dependencies, example Sonata Admin Bundle
docker-compose run --rm php-cli composer require sonata-project/admin-bundledocker-compose run --rm php-cli composer require sonata-project/doctrine-orm-admin-bundle
After cloning the project you can modify it according to your need