version: "3"

services:
  sympa:
    build: ./docker/sympa
    hostname: sympa
    restart: always
    volumes:
      - "./sympa/sympa:/etc/sympa"
      - "./sympa/syslog:/etc/syslog.d/"
      - "spool_sympa:/var/spool/sympa"
      - "spool_nullmailer:/var/spool/nullmailer"
      - "lib_sympa:/var/lib/sympa"
      - "./log/sympa:/var/log/"
    links:
      - pgsql
    environment:
      SYMPA_DOMAIN:
      SYMPA_LISTMASTER:
      SYMPA_LANG:
      SYMPA_WWSYMPA_URL:
      SYMPA_SOAP_URL:
      SYMPA_DB_TYPE:
      SYMPA_DB_HOST:
      SYMPA_DB_PORT:
      SYMPA_DB_NAME:
      SYMPA_DB_USER:
      SYMPA_DB_PASSWD:
      TZ:
      TRUSTED_PROXY:
      REMOTES:
    networks:
      - postfix
      - default

  postfix:
    build: ./docker/postfix
    hostname: postfix
    restart: always
    volumes:
      - "./sympa/sympa/shared:/etc/sympa/shared"
      - "./postfix/rsyslog:/etc/rsyslog.d1/"
      - "./postfix/dkim:/etc/dkimkeys/"
      - "./postfix/custom:/etc/postfix/custom"
      - "./log/postfix:/var/log/postfix"
      - "spool_postfix:/var/spool/postfix"
    networks:
      - postfix
    environment:
      POSTFIX_VIRTUAL_DOMAINS:
      MAILNAME:
      MY_NETWORKS:
      ROOT_ALIAS:
      MY_DESTINATION:
      TRUSTED_HOSTS:
      TZ:


  pgsql:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: ${SYMPA_DB_PASSWD}
      POSTGRES_USER: ${SYMPA_DB_USER}
    volumes:
    - "pgdata:/var/lib/postgresql/data"


volumes:
  pgdata:
  spool_sympa:
  spool_postfix:
  spool_nullmailer:
  lib_sympa:

networks:
  postfix:
    ipam:
      config:
        - subnet: 10.42.0.0/16
