Stack docker with Nginx, PHP 7.4, MySQL 8 & optional tools.
-
Create
.envfile from.env.dist. -
Define your local parameters:
VHOST_TDL: top level domain (.localby default =<your_domain>.local)VHOST_ROOT: app public root folder (publicby default =./app/<your_domain>/public/)LOCAL_PORT_*: localhost ports usedDB_*: database name, user and password
-
Run
docker-compose up -dto build & start docker containers.
Docker shortcuts. Run make to see the available tasks:
up docker-compose up -d --build --remove-orphans
stop docker-compose stop
restart docker-compose restart
down docker-compose down -v
reset docker-compose down -v && docker-compose up -d --build --remove-orphans
list docker-compose ps -a
perf docker stats -a
log docker-compose logs -ft [container=php]
ssh docker-compose exec -u [user=root] [container=php] /bin/sh -l
exec docker-compose exec -u [user=root] [container=php] [cmd="php --version"]
- Define
<your_domain>.<vhost_tdl>in your host file (example:127.0.0.1 my-website.local) - Create folder
./app/<your_domain>/<vhost_root>/(example:./app/my-website/public/) - Check in your browser
http://<your_domain>.<vhost_tdl>
I am using the Nginx docker image from the Devilbox projet (devilbox/docker-nginx-stable) to be able to use valid SSL certificates.
To enable secure HTTPS, add in your browser the Devilbox certificate available here:
./docker/nginx/volumes/ca/devilbox-ca.crt
Check in your browser https://<your_domain>.<vhost_tdl>
./docker/nginx/volumes/log= Logs (HTTP & PHP)./docker/nginx/volumes/ca= Certificates SSL./docker/php/volumes/conf/php.ini= Custom PHP configuration
To be able to use the tools, create docker-compose.override.yml file from docker-compose.override.yml.example and (re)start install.
Database Manager / phpMyAdmin
Cache Manager / phpMemcachedAdmin
Docker Manager / Portainer
Install project:
cd ./app
composer create-project symfony/skeleton:"^4.4" julienvolle.fr
Add in host file:
127.0.0.1 julienvolle.fr.local
127.0.0.1 *.julienvolle.fr.local
Add the certificate SSL in browser and let's go: