version: '3.8'

services:
  # CouchDB for testing
  couchdb:
    image: docker.io/couchdb:3.3
    container_name: mail2couch_test_couchdb
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=password
    ports:
      - "5984:5984"
    volumes:
      - couchdb_data:/opt/couchdb/data
    networks:
      - mail2couch_test

  # GreenMail IMAP server for testing
  greenmail:
    image: docker.io/greenmail/standalone:2.0.1
    container_name: mail2couch_test_imap
    ports:
      - "3143:3143"   # IMAP
      - "3993:3993"   # IMAPS
      - "3025:3025"   # SMTP
    environment:
      - GREENMAIL_OPTS=-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.users=testuser1:password123@localhost,testuser2:password456@localhost,syncuser:syncpass@localhost,archiveuser:archivepass@localhost
    networks:
      - mail2couch_test
    depends_on:
      - couchdb

volumes:
  couchdb_data:

networks:
  mail2couch_test:
    driver: bridge