Docker compose configuration and images for local development. In general developed for Magento 2 / Adobe Commerce development but easy may be used for other PHP based projects.
Package developed for Linux type OS and tested with Ubuntu 22.04.
- Install docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Configure docker to run on start up
sudo systemctl enable docker
sudo systemctl start docker
- Add user to docker group for correct launching and access (replace yourusername with your real username in the system)
sudo usermod -aG docker yourusername
- Add required nginx configuration to
conf/nginx
folder in package and register used local domain in your OS/etc/hosts
- Open cloned repository root folder (where docker-compose.yml placed) and start docker:
docker compose up -d
- Place files for application into installed package
www
directory - Choose local domain for application and add it to hosts configuration (eg.
/etc/hosts
on Ubuntu orC:\Windows\System32\drivers\etc\hosts
on Windows)## EXAMPLE FOR http://example.local ## 127.0.0.1 example.local www.example.local
- Create nginx config for application in the
conf/nginx
package folder (checkcong/nginx/example.conf
for details)- specify the root folder using path inside of container. For example if your have application in
www/example
thenroot /var/www/example;
should be specified in config - configure required version of PHP for FastCGI server (
fastcgi_pass
) using container name and default PHP port. For example for PHP 8.1 this will befastcgi_pass php81:9000
. You can useupstream
config for this purpose, for example:
upstream fastcgi_backend_exmp { server php82:9000; } .... location ~ ^/.+\.php(/|$) { fastcgi_pass fastcgi_backend_exmp; ....
- specify the root folder using path inside of container. For example if your have application in
- Restart nginx container and application should be accessible using previously defined local domain
docker container restart nginx
- prepare more detailed documentation and description (80% done)
- test prepared images and compose configuration (70% done)
- include additional services/images in package
create SH script for automatic deployment and configuration(deprecated as not needed for dev env)