services:
  dovecot:
    image: dovecot/dovecot:2.4-latest  # Oder spezifische 2.4.x Version
    container_name: dovecot24
    restart: unless-stopped
    ports:
      - "143:143"   # IMAP
      - "993:31993"   # IMAPS (SSL/TLS)
      - "110:110"   # POP3
      - "995:995"   # POP3S (SSL/TLS)
    volumes:
      - ./config/dovecot241.conf:/etc/dovecot/dovecot.conf  # Pfad zur Konfig
      - ./ssl:/etc/dovecot/ssl
      - ./mail:/var/mail
      - ./log:/var/log
    environment:
      - USER_PASSWORD=SUPERSECRET
    command: ["dovecot", "-F"]  # Foreground mit eigener Konfig
    networks:
      - mail_network

networks:
  mail_network:
    driver: bridge