services:

  app:
    image: roundcube/roundcubemail
    container_name: ${roundcubeServName}
    restart: ${restartPolicy}
    depends_on:
      - db
    volumes:
      - webmailWeb:/var/www/html
    # ports:
    #   - 8084:80
    networks:
      roundcubeNet:
      postfixNet:
    external_links:
      - ${smtpServName}:${smtpHost}
    environment:
      - ROUNDCUBEMAIL_DB_HOST=db
      - ROUNDCUBEMAIL_SKIN=elastic
      - ROUNDCUBEMAIL_DEFAULT_HOST=ssl://${smtpHost}.${domain}
      - ROUNDCUBEMAIL_SMTP_SERVER=ssl://${smtpHost}.${domain}
      - ROUNDCUBEMAIL_DEFAULT_PORT=993
      - ROUNDCUBEMAIL_SMTP_PORT=465
    env_file:
      - ../../secret/env-${roundcubeServName}
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${roundcubeServName}.rule=Host(`${webmailHost}.${domain}`)"
      - "traefik.docker.network=roundcubeNet"

  db:
    image: mariadb:10.5
    container_name: ${roundcubeDBName}
    restart: ${restartPolicy}
    volumes:
      - webmailDB:/var/lib/mysql
    env_file:
      - ../../secret/env-${roundcubeDBName}
    networks:
      roundcubeNet:

volumes:
  webmailDB:
  webmailWeb:

networks:
  roundcubeNet:
    external: true
    name: roundcubeNet
  postfixNet:
    external: true
    name: postfixNet
