ComposePress/docker-compose.yml
2025-06-02 00:50:27 +00:00

103 lines
3.0 KiB
YAML

# Buildkit to simplify the whole process of upgrading Wordpress with official images
#
# This version is designed for fpm, using a default.conf which references the wordpress service
#
# STEPS:
# Set COMPOSE_PROJECT_NAME in .env
# docker compose down -v
# Change wordpress version as required in Dockerfile.wordpress_fpm and .env (IMAGE_FIRST)
# docker compose -f docker-compose.first.yml build
# docker compose -f docker-compose.first.yml up -d
# docker compose -f docker-compose.first.yml down
# docker compose up -d
# at this point manually copy everything from wp-content-new to wp-content: cp -a wp-content-new/* wp-content/
#
# MAKE SURE PERMISSIONS ARE CORRECT in wp-content
# (if you need to) ./update-db
services:
database:
image: ${IMAGE_DATABASE:-database}
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
- MYSQL_USER=${MYSQL_USER:-wordpress}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-fake}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-fake}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
restart: always
networks:
- letsencrypt
wordpress:
# build:
# context: .
# dockerfile: Dockerfile.wordpress_fpm
image: ${IMAGE_WEB:-wordpress}
volumes:
- html:/var/www/html
- content:/var/www/html/wp-content
- ./wp-config.php:/var/www/html/wp-config.php
environment:
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST:-database:3306}
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD:-fake}
- VIRTUAL_HOST=${VIRTUAL_HOST:-wordpress}
- LETSENCRYPT_HOST=${LETSENCRYPT_HOST:-wordpress}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-me}
- LETSENCRYPT_TEST=${LETSENCRYPT_TEST:-true}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
restart: always
command: >
bash -c "chown -R www-data:www-data /var/www/html/wp-content && php-fpm"
networks:
- letsencrypt
- default
# nginx:latest and/or can be customized
web:
# build:
# context: .
# dockerfile: Dockerfile.nginx
image: nginx:latest
restart: always
volumes:
- html:/var/www/html/
- content:/var/www/html/wp-content
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./nginx.conf:/etc/nginx/nginx.conf
environment:
- VIRTUAL_HOST=${VIRTUAL_HOST:-wordpress}
- LETSENCRYPT_HOST=${LETSENCRYPT_HOST:-wordpress}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-me}
- LETSENCRYPT_TEST=${LETSENCRYPT_TEST:-true}
networks:
- letsencrypt
- default
# No variable substition for volumes in this version
volumes:
db:
external: true
name: ${DB_VOLUME:-db}
html:
name: ${HTML_VOLUME:-html}
content:
external: true
name: ${CONTENT_VOLUME:-content}
networks:
letsencrypt:
external: true
# default:
# name: ${COMPOSE_PROJECT_NAME}_default