services:
  database:
    container_name: "edonsopera_mariadb"
    image: mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
    volumes:
      - ./mariadb:/var/lib/mysql
    ports:
      - '8306:3306'
    restart: on-failure
    networks:
      - backend-network

  phpmyadmin:
    container_name: "edonsopera_phpmyadmin"
    build:
      context: ./docker/phpmyadmin
    restart: always
    environment:
      PMA_HOST: database
    ports:
      - "8443:443"
    volumes:
      - ./phpmyadmin/config.inc.php:/var/www/html/config.inc.php
      - ./ssl:/cert
    depends_on:
      - database
    networks:
      - backend-network

  maildev:
    image: maildev/maildev
    container_name: "edonsopera_maildev"
    restart: always
    environment:
      - TZ=Europe/France
      - MAILDEV_WEB_PORT=1080
      - MAILDEV_SMTP_PORT=1025
    ports:
      - "8080:1080"
      - "8025:1025"
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
    volumes:
      - ./ssl:/cert
    networks:
      - backend-network
volumes:
  edonsopera:
networks:
  backend-network:
    driver: bridge