services:
  wordpress:
    image: wordpress
    restart: always
    ports:
      - 127.0.0.1:8086:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: db_user
      WORDPRESS_DB_PASSWORD: db_pass
      WORDPRESS_DB_NAME: wordpress
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_pass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:
