networks:
  inception:
    name: inception
    driver: bridge

services:
  mariadb:
    container_name: mariadb
    build: ./requirements/mariadb
    ports:
      - "3306:3306"
    env_file:
      - .env
    volumes:
      - mariadb_data:/var/lib/mysql
    networks:
      - inception
    restart: always

  wordpress:
    container_name: wordpress
    build:
      context: ./requirements/wordpress
      dockerfile: Dockerfile
    depends_on:
      - mariadb
    env_file:
      - .env
    expose:
      - "9000"
    networks:
      - inception
    volumes:
      - wordpress_data:/var/www/html
    restart: always

  nginx:
    container_name: nginx
    build: ./requirements/nginx
    depends_on:
      - wordpress
      - mariadb
    ports:
      - "443:443"
    volumes:
      - wordpress_data:/var/www/html
      - ./requirements/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
    networks:
      - inception
    restart: always

volumes:
  mariadb_data:
    driver: local
    driver_opts:
      type: none
      device: /home/${USER}/data/mysql
      o: bind
  wordpress_data:
    driver: local
    driver_opts:
      type: none
      device: /home/${USER}/data/html
      o: bind
