wordpress-dev/production/docker-compose.yml

84 lines
2.2 KiB
YAML

version: '3.7'
networks:
web:
external: true
backend:
external: false
driver: bridge
services:
redis:
image: 'bitnami/redis:5.0'
networks:
- backend
container_name: ${HOST}-redis
restart: unless-stopped
environment:
- ALLOW_EMPTY_PASSWORD=yes
# volumes:
# - 'redis-data:/bitnami/redis/data'
labels:
- "traefik.enable=false"
db:
image: mariadb:10.4
container_name: ${HOST}-mysql
command: --default-authentication-plugin=mysql_native_password
networks:
- backend
restart: unless-stopped
# env_file:
# - .env
volumes:
# - ./wp-db:/var/lib/mysql
- ./config/my.cnf:/etc/mysql/conf.d/zzz_my.cnf
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
labels:
- "traefik.enable=false"
nginx:
image: nginx:1.17-alpine
depends_on:
- wordpress
container_name: ${HOST}-nginx
networks:
- backend
- web
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
- ./wordpress:/usr/share/nginx/html:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx-${HOST}.entrypoints=http"
- "traefik.http.routers.nginx-${HOST}.rule=Host(`${HOST}.${DOMAIN}`)"
- "traefik.http.middlewares.nginx-${HOST}-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.nginx-${HOST}.middlewares=nginx-${HOST}-https-redirect"
- "traefik.http.routers.nginx-${HOST}-secure.entrypoints=https"
- "traefik.http.routers.nginx-${HOST}-secure.rule=Host(`${HOST}.${DOMAIN}`)"
- "traefik.http.routers.nginx-${HOST}-secure.tls=true"
- "traefik.http.routers.nginx-${HOST}-secure.tls.certresolver=http"
- "traefik.http.services.nginx-${HOST}.loadbalancer.server.port=80"
- "traefik.http.routers.nginx-${HOST}-secure.service=nginx-${HOST}"
- "traefik.docker.network=web"
wordpress:
depends_on:
- db
- redis
networks:
- backend
container_name: ${HOST}-wordpress
# env_file:
# - .env
build: ./
volumes:
- ./wordpress:/var/www/wordpress
labels:
- "traefik.enable=false"