version: '3.8'

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "127.0.0.1:8000:80"
    environment:
      # We tell WordPress where the DB is (Service Name:Port)
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wp_user
      WORDPRESS_DB_PASSWORD: wp_password
      WORDPRESS_DB_NAME: press_portal
    volumes:
      - wp_content:/var/www/html
    depends_on:
      - db

  db:
    image: mysql:8.0
    # FIX: Force MySQL 8 to use the standard password method so PHP can connect easily
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_DATABASE: press_portal
      MYSQL_USER: wp_user
      MYSQL_PASSWORD: wp_password
      MYSQL_ROOT_PASSWORD: root_secret_password
    volumes:
      - db_data:/var/lib/mysql

volumes:
  wp_content:
  db_data:
