version: "3.1"

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "8000:80"
    environment:
      WORDPRESS_DB_HOST: 194.5.157.121
      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

    depends_on:
      - db

  db:
    image: mariadb
    network_mode: host

    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:
      - "25: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:
      - "8080:80"

  dovecot:
    image: instrumentisto/dovecot
    ports:
      - "993:993" # Port pour IMAP sécurisé (vous pouvez également exposer le port 143 pour IMAP non sécurisé)
      - "995: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

volumes:
  db_data:
  email_db_data:
  maildata:
