version: '3'

services:
  mariadb:
    container_name: mariadb
    networks:
      - inception
    build:
      context: ./requirements/mariadb
      dockerfile: Dockerfile
    env_file: .env
    volumes:
      - mariadb:/var/lib/mysql
    restart: unless-stopped
    expose:
      - "3306"

  nginx:
    container_name: nginx
    volumes:
      - wordpress:/var/www/wordpress
    networks:
      - inception
    depends_on:
      - wordpress
    build:
      context: requirements/nginx
      dockerfile: Dockerfile
    env_file: .env
    ports:
      - "443:443"
    restart: on-failure

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

volumes:
  wordpress:
    driver: local
    driver_opts:
    type: 'none'
    o: 'bind'
    device: '${HOME}/data/wordpress'
  mariadb:
    driver: local
    driver_opts:
    type: 'none'
    o: 'bind'
    device: '${HOME}/data/mariadb'

networks:
  inception:
  driver: bridge

