services:
  mail:
    image: docker.io/mailserver/docker-mailserver:latest
    hostname: ${smtpHost}
    domainname: ${domain}
    container_name: ${smtpServName}
    networks:
      - postfixNet
    #ports:
      #- ${MAIN_IP}:25:25
    volumes:
      - mailData:/var/mail
      - mailState:/var/mail-state
      - mailLog:/var/log/mail
      - mailConfig:/tmp/docker-mailserver/
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/letsencrypt:/etc/letsencrypt:ro
    environment:
      - HOSTNAME=${smtpHost}
      - DOMAINNAME=${domain}
      - CONTAINER_NAME=${smtpServName}
    env_file:
      - env-config
      - ../../secret/env-${smtpServName}
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
    restart: always

volumes:
  mailData:
  mailState:
  mailLog:
  mailConfig:

networks:
  postfixNet:
    external: true
    name: postfixNet
