version: '3.3'

services:

  nginx:
    build: ./requirements/nginx
    container_name: nginx
    depends_on:
      - wordpress
      - mariadb
    ports:
      - 80:80
      - 443:443
    volumes:
      #- wpfiles:/var/www/html
      - ./wordpress:/var/www/html
      - ./requirements/nginx/conf/nginx.conf:/etc/nginx/conf.d/nginx.conf
    networks:
      - wpnetwork
    #restart: always

  wordpress:
    build: ./requirements/wordpress
    container_name: wordpress
    volumes:
     # - wpfiles:/var/www/html
     - ./wordpress:/var/www/html
    depends_on:
      - mariadb
    networks:
      - wpnetwork
    #restart: always

  mariadb:
    build: ./requirements/mariadb
    container_name: mariadb
    environment:
      MARIADB_DATABASE: myDatabase
      MARIADB_USER: example-user
      MARIADB_PASSWORD: my_cool_secret
      MARIADB_ROOT_PASSWORD: my-secret-pw
    volumes:
      - ./requirements/mariadb:/var/lib/mysql
      #- wpfiles:/var/www/html
      - ./wordpress:/var/www/html
    networks:
      - wpnetwork
    #restart: always

networks:
  wpnetwork:

volumes:
  wpfiles: