What’s the reasoning for setting it up this way instead of doing
#docker-compose.yml
services:
wordpress:
image: wordpress:php8.3-fpm
restart: unless-stopped
container_name: wordpress
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: wordpress-db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- ./wordpress:/var/www/html
-./custom.ini
db:
image: mariadb:11.2.2
restart: unless-stopped
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- ./db:/var/lib/mysql
networks:
default:
name: caddy_network
external: true
#custom.ini
file_uploads = On
upload_max_filesize = 20056M
post_max_size = 20056M
memory_limit = 512M
in a separate directory:
#docker-compose.yml
services:
caddy:
image: caddy:2.7.6-alpine
container_name: caddy
hostname: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./caddy_config:/config
- ./caddy_data:/data
networks:
default:
name: caddy_network
external: true
#Caddyfile
wordpress.example.com {
reverse_proxy wordpress:80
}