services:
  mail:
    image: postfixkaz
    hostname: ${smtpHost}
    domainname: ${domain}
    container_name: ${smtpServName}
    networks:
      - postfixNet
      - jirafeauNet
      - ldapNet
    external_links:
      - ${jirafeauServName}:${fileHost}
    ports:
      - ${MAIN_IP}:25:25
      - ${MAIN_IP}:143:143
      - ${MAIN_IP}:587:587
      - ${MAIN_IP}:465:465
      - ${MAIN_IP}:993:993
      - ${MAIN_IP}:4190:4190
    volumes:
      - mailData:/var/mail
      - mailState:/var/mail-state
      - mailLog:/var/log/mail
      - mailConfig:/tmp/docker-mailserver/
      - filterConfig:/home/filter/config/
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/letsencrypt:/etc/letsencrypt:ro
#      - /etc/ssl:/etc/ssl:ro
#      - /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro
    environment:
      - HOSTNAME=${smtpHost}
      - DOMAINNAME=${domain}
      - CONTAINER_NAME=${smtpServName}
      - LDAP_SERVER_HOST=ldap://${ldapServName} # your ldap container/IP/ServerName
      - LDAP_SEARCH_BASE=${ldap_root}
    env_file:
      - env-config
      - ../../secret/env-${smtpServName}
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
    restart: always

volumes:
  mailData:
  mailState:
  mailLog:
  mailConfig:
  filterConfig:
    external: true

networks:
  postfixNet:
    external: true
    name: postfixNet
  jirafeauNet:
    external: true
    name: jirafeauNet
  ldapNet:
    external: true
    name: ldapNet
