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
.docker
directory, where thedocker-compose.yml
file is located - Create the
.env
file, copying it from.env.example
- Replace the default environment variables values on
.env
file - 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_HOST
variables insidedocker-compose.yml
127.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
.docker
directory, where thedocker-compose.yml
file 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}.local
http://phpmyadmin.${PROJECT_NAME}.local
If you wanna to install other dependencies with composer, run the following
- Move to the
.docker
directory, where thedocker-compose.yml
file is located - Install any needed dependencies, example Sonata Admin Bundle
docker-compose run --rm php-cli composer require sonata-project/admin-bundle
docker-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