version: "3"
services:
  wordpress:
    image: wordpress
    ports:
      - "${WORDPRESS_PORT:-80}:80"
    environment:
      - "WORDPRESS_DB_HOST=${DB_HOST:-db}"
      - "WORDPRESS_DB_NAME=${DB_NAME:-wordpress}"
      - "WORDPRESS_DB_USER=${DB_USER:-wordpress}"
      - "WORDPRESS_DB_PASSWORD=${DB_PASSWORD:-wordpress}"
    volumes:
      - wordpress-data:/var/www/html
      - ./wp-content/themes:/usr/src/wordpress/wp-content/themes
      - ./wp-content/plugins:/usr/src/wordpress/wp-content/plugins
      - ./wp-content/uploads:/usr/src/wordpress/wp-content/uploads
    depends_on:
      - db
    networks:
      - wp-network
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "${PMA_FOWARD_PORT:-8080}:80"
    environment:
      - "PMA_HOST=${DB_HOST:-db}"
      - "PMA_DB_ENGINE=mysql"
      - "MYSQL_PASSWORD=${DB_PASSWORD:-wordpress}"
      - "PMA_THEME=metro"
      - "PMA_USER=${DB_USER:-wordpress}"
      - "PMA_PASSWORD=${DB_PASSWORD:-wordpress}"
      - "UPLOAD_LIMIT=${DB_UPLOAD_LIMIT:-10M}"
    networks:
      - wp-network
    depends_on:
      - db
  db:
    image: mysql
    command: '--default-authentication-plugin=mysql_native_password'
    ports:
      - "${FORWARD_DB_PORT:-3306}:${DB_PORT:-3306}"
    environment:
      - "MYSQL_DATABASE=${DB_NAME:-wordpress}"
      - "MYSQL_USER=${DB_USER:-wordpress}"
      - "MYSQL_PASSWORD=${DB_PASSWORD:-wordpress}"
      - "MYSQL_RANDOM_ROOT_PASSWORD='1'"
    volumes:
      - db-data:/var/lib/mysql
    networks:
      - wp-network
volumes:
  wordpress-data: {}
  db-data: {}
networks: 
  wp-network:
    driver: bridge