A dockerization for a typical NGINX-PHP-MARIADB tool-stack.
.data
--> will contain MYSQL-datacode
--> contains code vor running in NGINX/PHPpublic
--> thats the NGINX-root-folder (domain entry point)
config
--> contains config-files that are used in the docker-containersimages
--> contains docker container descriptionscustom-php
--> the description for the php container
docker-compose.yml
--> file for docker-compose
docker build --rm -f "images/custom-php/Dockerfile" -t custom-php:7.3-fpm "images/custom-php"
docker-compose -f "docker-compose.yml" up -d --build
docker-compose -f "docker-compose.yml" down
For an php-app to write inside the volume of the container (updates, uploads, ...), the files need to be have the owner "www-data". This is all done on the host-maschine.
# list permissions
ls -l
# change owner of the code folder (set owner to "www-data" for an php file to change data
sudo chown -R www-data:www-data ./code
# or use (33 is the ID of the user "www-data" in the container)
sudo chown -R 33:33 ./code
Optionally the following folders can be set with the local user to edit them:
sudo chown -R YOUR_USER:YOUR_USER ./code/public/s-content/themes/child_theme
sudo chown -R YOUR_USER:YOUR_USER ./code/wp-config.php
More infos: https://stackoverflow.com/a/29251160