daredevil001

WORDPRESS_docker-compose.yml

Dec 12th, 2021 (edited)
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.56 KB | None | 0 0
  1. # ./docker-compose.yml
  2. version: '3'
  3.  
  4. services:
  5. #PHP Service
  6.   php:
  7.     image: php-dockerfile
  8.     build:
  9.       context: ./
  10.       dockerfile: ./Dockerfile
  11.       target: php-dockerfile
  12.     container_name: php
  13.     restart: unless-stopped
  14.     env_file: .env
  15.     environment:
  16.      - WORDPRESS_DB_HOST=db:3306
  17.       - WORDPRESS_DB_USER=$MYSQL_USER
  18.       - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
  19.       - WORDPRESS_DB_NAME=wordpress
  20.       - VIRTUAL_HOST=blog.example.com
  21.     volumes:
  22.      - wordpress:/var/www/html
  23.     working_dir: /var/www
  24.     networks:
  25.      - net
  26.  
  27.   #MySQL Service
  28.   db:
  29.     depends_on:
  30.      - php
  31.     image: mysql-dockerfile
  32.     build:
  33.       context: ./
  34.       dockerfile: ./Dockerfile
  35.       target: mysql-dockerfile
  36.     container_name: db
  37.     restart: unless-stopped
  38.     env_file: .env
  39.     environment:
  40.      - MYSQL_DATABASE=wordpress
  41.     volumes:
  42.      - dbdata:/var/lib/mysql
  43.     command: '--default-authentication-plugin=mysql_native_password'
  44.     networks:
  45.      - net
  46.  
  47.   #Nginx Service
  48.   webserver:
  49.     depends_on:
  50.      - db
  51.     image: nginx-dockerfile
  52.     build:
  53.       context: ./
  54.       dockerfile: ./Dockerfile
  55.       target: nginx-dockerfile
  56.     container_name: webserver
  57.     restart: unless-stopped
  58.     expose:
  59.      - 80
  60.       - 443
  61.     volumes:
  62.      - wordpress:/var/www/html
  63.       - vhostd:/etc/nginx/vhost.d
  64.     labels:
  65.      - "traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.domain.com"
  66.     networks:
  67.      - net
  68.  
  69. volumes:
  70.   wordpress:
  71.   dbdata:
  72.   vhostd:
  73. networks:
  74.   net:
  75.     external: true
Add Comment
Please, Sign In to add comment