version: '3'
services:
  roundcube:
    image: roundcube/roundcubemail:1.4.x-apache
    restart: "unless-stopped"
    depends_on:
      - db
    volumes:
      - /data/amaglio.fr/app/plugins/enigma/home:/var/www/html/plugins/enigma/home
      - /data/amaglio.fr/app/config/config.inc.php:/var/www/html/config/config.inc.php
      - /data/amaglio.fr/app/enigma_pgp_homedir:/data/enigma_pgp_homedir
    env_file: /data/amaglio.fr/env
    environment:
      ROUNDCUBEMAIL_DB_TYPE: pgsql
      ROUNDCUBEMAIL_DB_HOST: db
      ROUNDCUBEMAIL_DB_USER: postgres
      ROUNDCUBEMAIL_DB_NAME: postgres
      ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE: 25M

      # imap server
      ROUNDCUBEMAIL_DEFAULT_HOST: ssl://mail20.lwspanel.com
      ROUNDCUBEMAIL_DEFAULT_PORT: 993
      ROUNDCUBEMAIL_SMTP_SERVER: tls://mail20.lwspanel.com
      ROUNDCUBEMAIL_SMTP_PORT: 587
      ROUNDCUBEMAIL_PLUGINS: archive,zipdownload,enigma,attachment_reminder
    networks:
      default:
        ipv4_address: 172.29.5.100
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 100M

  db:
    # https://hub.docker.com/_/postgres?tab=description
    image: postgres:9.6-alpine
    restart: "unless-stopped"
    env_file: /data/amaglio.fr/env
    volumes:
      - /data/amaglio.fr/db:/var/lib/postgresql/data
    networks:
      default:
        ipv4_address: 172.29.5.101
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 100M
networks:
  default:
    ipam:
      config:
        - subnet: 172.29.5.0/24