91 lines
3.1 KiB
Docker
91 lines
3.1 KiB
Docker
# DOMAIN=example.com docker stack deploy -c wordpress.yml wordpress
|
|
|
|
services:
|
|
nginx:
|
|
image: ethibox/nginx-proxy:latest
|
|
environment:
|
|
- SERVER_NAME={{ index .Service.Labels "com.docker.stack.namespace" }}_app
|
|
volumes:
|
|
- ${VOLUME_PATH}wordpress:/var/www/html:cached
|
|
deploy:
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.routers.wordpress-${NUMBER:-1}.rule=Host(`${DOMAIN:-wordpress.localhost}`)
|
|
- traefik.http.routers.wordpress-${NUMBER:-1}.entrypoints=${SCHEME:-https}
|
|
- traefik.http.routers.wordpress-${NUMBER:-1}.service=wordpress-${NUMBER:-1}
|
|
- traefik.http.routers.wordpress-${NUMBER:-1}.tls.certresolver=letsencrypt
|
|
- traefik.http.services.wordpress-${NUMBER:-1}.loadbalancer.server.port=80
|
|
networks:
|
|
- internal
|
|
- traefik
|
|
|
|
app:
|
|
image: wordpress:${VERSION:-6-fpm-alpine}
|
|
entrypoint: /bin/sh
|
|
command:
|
|
- -c
|
|
- |
|
|
echo "upload_max_filesize = $$WP_UPLOAD_MAX_FILESIZE" > $$PHP_INI_DIR/conf.d/custom.ini
|
|
echo "memory_limit = $$WP_MEMORY_LIMIT" >> $$PHP_INI_DIR/conf.d/custom.ini
|
|
echo "post_max_size = $$WP_POST_MAX_SIZE" >> $$PHP_INI_DIR/conf.d/custom.ini
|
|
echo "max_execution_time = $$WP_MAX_EXECUTION_TIME" >> $$PHP_INI_DIR/conf.d/custom.ini
|
|
docker-entrypoint.sh php-fpm
|
|
volumes:
|
|
- /etc/localtime:/etc/localtime:ro
|
|
- ${VOLUME_PATH}wordpress:/var/www/html:cached
|
|
environment:
|
|
WORDPRESS_DEBUG: ${WORDPRESS_DEBUG:-false}
|
|
WORDPRESS_DB_HOST: ${MYSQL_HOST:-mariadb}
|
|
WORDPRESS_DB_USER: ${MYSQL_USER:-wordpress}
|
|
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-myp@ssw0rd}
|
|
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX:-wp_}
|
|
WORDPRESS_CONFIG_EXTRA: |
|
|
define('DISABLE_WP_CRON', getenv('DISABLE_WP_CRON'));
|
|
define('WP_HOME', getenv('WP_HOME'));
|
|
define('WP_SITEURL', getenv('WP_SITEURL'));
|
|
WP_HOME: ${SCHEME:-https}://${DOMAIN:-wordpress.localhost}
|
|
WP_SITEURL: ${SCHEME:-https}://${DOMAIN:-wordpress.localhost}
|
|
WP_UPLOAD_MAX_FILESIZE: ${WP_UPLOAD_MAX_FILESIZE:-256M}
|
|
WP_MAX_EXECUTION_TIME: ${WP_MAX_EXECUTION_TIME:-300}
|
|
WP_MEMORY_LIMIT: ${WP_MEMORY_LIMIT:-256M}
|
|
WP_POST_MAX_SIZE: ${WP_POST_MAX_SIZE:-256M}
|
|
DISABLE_WP_CRON: ${DISABLE_WP_CRON:-true}
|
|
networks:
|
|
- internal
|
|
|
|
cron:
|
|
image: alpine:latest
|
|
entrypoint: /bin/sh
|
|
command:
|
|
- -c
|
|
- |
|
|
echo '* * * * * wget -q -O - http://nginx/wp-cron.php?doing_wp_cron' | crontab -
|
|
crond -f
|
|
volumes:
|
|
- /etc/localtime:/etc/localtime:ro
|
|
networks:
|
|
- internal
|
|
|
|
mariadb:
|
|
image: mariadb:${MARIADB_VERSION:-10.5.9}
|
|
volumes:
|
|
- ${VOLUME_PATH}mariadb:/var/lib/mysql:cached
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-myp@ssw0rd}
|
|
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
|
|
- MYSQL_USER=${MYSQL_USER:-wordpress}
|
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-myp@ssw0rd}
|
|
networks:
|
|
- internal
|
|
|
|
volumes:
|
|
mariadb:
|
|
wordpress:
|
|
|
|
networks:
|
|
internal:
|
|
driver: overlay
|
|
attachable: true
|
|
traefik:
|
|
external: true
|
|
name: traefik-net
|