Adds wordpress:cl in it's own container.

This commit is contained in:
Jonathan Rosenbaum 2025-06-14 21:57:39 +00:00
parent 1dc2e1ceb6
commit bad1d978cc
2 changed files with 27 additions and 3 deletions

View File

@ -40,7 +40,7 @@ services:
wordpress_${SERVICE_SUFFIX}:
image: ${IMAGE_WEB:-wordpress}
container_name: ${COMPOSE_PROJECT_NAME}_wordpress
container_name: ${COMPOSE_PROJECT_NAME}_wordpress
volumes:
- html:/var/www/html
- content:/var/www/html/wp-content
@ -54,7 +54,7 @@ services:
- VIRTUAL_HOST=${VIRTUAL_HOST:-wordpress}
- LETSENCRYPT_HOST=${LETSENCRYPT_HOST:-wordpress}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-me}
- LETSENCRYPT_TEST=${LETSENCRYPT_TEST:-true}
- LETSENCRYPT_TEST=${LETSENCRYPT_TEST:-true}
logging:
driver: "json-file"
options:
@ -88,7 +88,28 @@ services:
- LETSENCRYPT_TEST=${LETSENCRYPT_TEST:-true}
networks:
- custom_network
- letsencrypt
- letsencrypt
wpcli_${SERVICE_SUFFIX}:
image: wordpress:cli
container_name: ${COMPOSE_PROJECT_NAME}_wpcli
depends_on:
- database_${SERVICE_SUFFIX}
- wordpress_${SERVICE_SUFFIX}
command: tail -f /dev/null # Keeps the container running for CLI commands
volumes:
- html:/var/www/html
- content:/var/www/html/wp-content
- ./wp-config.php:/var/www/html/wp-config.php
user: "33:${HOST_GID}"
environment:
- WORDPRESS_DB_HOST=database_${COMPOSE_PROJECT_NAME}:3306
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD:-fake}
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
- MYSQL_USER=${MYSQL_USER:-wordpress}
- TABLE_PREFIX=${TABLE_PREFIX:-wp_}
networks:
- custom_network
# No variable substition for volumes in this version
volumes:

View File

@ -11,10 +11,13 @@
# Load variables from .env file
if [ -f .env ]; then
source .env
chmod 0664 wp-config.php
fi
export SERVICE_SUFFIX=${COMPOSE_PROJECT_NAME:-main}
export COMPOSE_PROJECT_NAME
export HOST_UID=$(id -u)
export HOST_GID=$(id -g)
envsubst < docker-compose.template.yml > docker-compose.yml
# Define the new value for the database host