version: "3.1"

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "8000:80"
    environment:
      WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST}
      WORDPRESS_DB_USER: ${WORDPRESS_DB_USER}
      WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
      WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME}
      WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX}
    volumes:
      - ./pamelamichel:/var/www/html
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    restart: always

    depends_on:
      - db

  db:
    image: mariadb
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
  email_db:
    image: mariadb
    volumes:
      - email_db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE2}
      MYSQL_USER: ${MYSQL_USER2}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD2}

  # Ajout du service Postfix pour le serveur de messagerie
  postfix:
    image: catatnight/postfix
    environment:
      maildomain: pamelamichel.com
      smtp_user: user:pamelamichel_password
    ports:
      - "2525:25"

  # Ajout du service Roundcube pour le webmail
  roundcube:
    image: roundcube/roundcubemail
    depends_on:
      - email_db
    environment:
      ROUNDCUBEMAIL_DB_TYPE: ${ROUNDCUBEMAIL_DB_TYPE}
      ROUNDCUBEMAIL_DB_HOST: ${ROUNDCUBEMAIL_DB_HOST}
      ROUNDCUBEMAIL_DB_USER: ${ROUNDCUBEMAIL_DB_USER}
      ROUNDCUBEMAIL_DB_PASSWORD: ${ROUNDCUBEMAIL_DB_PASSWORD}
      ROUNDCUBEMAIL_DB_NAME: ${ROUNDCUBEMAIL_DB_NAME}
    ports:
      - "8090:80"

  dovecot:
    image: instrumentisto/dovecot
    ports:
      - "9993:993" # Port pour IMAP sécurisé (vous pouvez également exposer le port 143 pour IMAP non sécurisé)
      - "9995:995" # Port pour POP3 sécurisé (vous pouvez également exposer le port 110 pour POP3 non sécurisé)
    volumes:
      - maildata:/var/mail
      - ./dovecot-config:/etc/dovecot # Montez votre dossier de configuration personnalisée Dovecot ici
    depends_on:
      - postfix
  # Si vous voulez un serveur IMAP/POP3 (comme Dovecot), vous pouvez l'ajouter ici
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8080:80"
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
    depends_on:
      - db

volumes:
  db_data:
  pamelamichel:
  email_db_data:
  maildata:
