captainVersion: 4 services: $$cap_appname: ports: - '25:25' - '110:110' - '143:143' - '465:465' - '587:587' - '993:993' - '995:995' volumes: - /etc/localtime:/etc/localtime - $$cap_appname-data-backup-mysql:/var/vmail/backup/mysql - $$cap_appname-data-mailboxes:/var/vmail/vmail1 - $$cap_appname-data-mlmmj:/var/vmail/mlmmj - $$cap_appname-data-mlmmj-archive:/var/vmail/mlmmj-archive - $$cap_appname-data-imapsieve-copy:/var/vmail/imapsieve_copy - $$cap_appname-data-custom:/opt/iredmail/custom - $$cap_appname-data-ssl:/opt/iredmail/ssl - $$cap_appname-data-mysql:/var/lib/mysql - $$cap_appname-data-clamav:/var/lib/clamav - $$cap_appname-data-sa-rules:/var/lib/spamassassin - $$cap_appname-data-postfix-queue:/var/spool/postfix restart: always caproverExtra: dockerfileLines: - ARG VERSION=stable - FROM iredmail/mariadb:$VERSION - WORKDIR /iredmail - ARG FIRST_MAIL_DOMAIN - ARG HOSTNAME=mail.$FIRST_MAIL_DOMAIN - ARG FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=1234 - ARG MLMMJADMIN_API_TOKEN - ARG ROUNDCUBE_DES_KEY - ARG ADMIN_VERSION=NoChange - ENV ADMIN_VERSION=$ADMIN_VERSION - ENV FIRST_MAIL_DOMAIN=$FIRST_MAIL_DOMAIN - ENV HOSTNAME=$HOSTNAME - ENV FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=$FIRST_MAIL_DOMAIN_ADMIN_PASSWORD - ENV MLMMJADMIN_API_TOKEN=$MLMMJADMIN_API_TOKEN - ENV ROUNDCUBE_DES_KEY=ROUNDCUBE_DES_KEY - >- RUN echo "if [\"$ADMIN_VERSION\" != \"NoChange\" && \"$ADMIN_VERSION\" != \"\$(ls /opt/www/ | grep 'iRedAdmin-' | cut -d'-' -f2)\"]; then wget -c -q https://github.com/iredmail/iRedAdmin/archive/$ADMIN_VERSION.tar.gz && tar xzf $ADMIN_VERSION.tar.gz -C /opt/www && rm -f $ADMIN_VERSION.tar.gz && cp -R -f /opt/www/iRedAdmin-$ADMIN_VERSION/* /opt/www/iredadmin && sleep 1; rm -r /opt/www/iRedAdmin-$ADMIN_VERSION; fi" >> build.sh - RUN sh build.sh && rm build.sh - >- RUN cat /opt/www/iredadmin/templates/default/layout.html | replace '
  • Webmail
  • - ARG fix_http="\"server { listen 80; server_name _; include /etc/nginx/templates/roundcube.tmpl; location ~ ^/iredadmin/(.*) {return 301 /;}location = /iredadmin {return 301 /;} location / { proxy_pass http://0.0.0.0:8080/; add_header Content-Security-Policy \\\"\\\"; } location ~ \.php$ { root /opt/www/roundcubemail; include /etc/nginx/templates/fastcgi_php.tmpl; fastcgi_param SCRIPT_FILENAME /opt/www/roundcubemail\$fastcgi_script_name; } location ~ ^/(bin|config|installer|logs|SQL|temp|vendor)/.* { deny all; } location ~ ^/(CHANGELOG|composer.json|INSTALL|jsdeps.json|LICENSE|README|UPGRADING)$ { deny all; } location ~ ^/plugins/.*/config.inc.php.* { deny all; } location ~ ^/plugins/enigma/home(\$|/.*) { deny all; } }\"" - >- ARG full_Script="rm /etc/nginx/sites-enabled/00-default-ssl.conf \\n echo -e $fix_http >> /etc/nginx/sites-enabled/00-default-ssl.conf \\n cd /opt/www/iredadmin \\n python3 iredadmin.py & disown" - RUN echo $full_Script >> /docker/entrypoints/nginx.sh - >- RUN echo "\$config['force_https'] = false;" >> /opt/www/roundcubemail/config/config.inc.php - >- ENV addHTML="\n
    \n

    MX record

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n >\n \n \n \n \n \n \n \n \n
    NAMEPRIORITYTTLTYPEDATA
    {{ cur_domain }}1014400mx
    autodiscover.{{ cur_domain }}1014400mx
    autoconfig.{{ cur_domain }}1014400mx
    \n

    SPF record

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    NAMETTLTYPEDATA
    {{ cur_domain }}3600TXT\"v=spf1 mx -all\"
    \n

    DKIM record

    \n \n \n \n \n \n \n \n \n {%set get_dns=dns_data()%}\n \n \n \n \n \n
    NAMETTLTYPEDATA
    dkim._domainkey.{{ cur_domain }}{{ get_dns[0] }}{{ get_dns[1] }}{{ get_dns[2] }}
    \n

    SRV record for Jabber/XMPP service

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    NAMETTLPORTPRIORITYWEIGHTTYPEDATA
    _xmpp-client._tcp.{{ cur_domain }}18000522205SRV
    _xmpp-server._tcp.{{ cur_domain }}18000526905SRV
    \n

    *You also need to setup reverse PTR record for server IP address. Documentation.

    \n \n
    " - >- RUN cat /opt/www/iredadmin/templates/default/sql/domain/profile.html | replace 'id=\"profile_general\">' 'id="profile_general">addHTML' | tee /opt/www/iredadmin/templates/default/sql/domain/profile.html - >- RUN echo "import os\nf = open('/opt/www/iredadmin/templates/default/sql/domain/profile.html', 'r')\nprint(f.read().replace('addHTML', os.environ['addHTML'].replace('\\\\\\\n', '\\\\n')))\nf.close()" >> buildHTML.py - >- RUN python3 buildHTML.py | tee /opt/www/iredadmin/templates/default/sql/domain/profile2.html - RUN rm buildHTML.py - >- RUN cat /opt/www/iredadmin/templates/default/sql/domain/profile2.html | tee /opt/www/iredadmin/templates/default/sql/domain/profile.html && rm /opt/www/iredadmin/templates/default/sql/domain/profile2.html - ENV addHTML='' - >- RUN cat /opt/www/iredadmin/libs/iredbase.py | replace 'jinja_env_vars = {' "$(echo 'def dns_data():\n all_keys = os.popen("amavisd-new -c /etc/amavis/conf.d/50-user showkeys").read().split(".")[-1].strip()\n next__ = all_keys.split(" ")\n text_with_remove = " ".join(next__[3:]).strip()[:-1]\n text__ = "".join(map(lambda x: x.strip(), text_with_remove.split("\"")))\n return [next__[0], next__[1], text__]\njinja_env_vars = {"dns_data":dns_data,' | sed -e $'s/\\\\n/\\\n/g')" | tee /opt/www/iredadmin/libs/iredbase.py - RUN apt install -y amavisd-new - EXPOSE 80 443 25 465 587 110 995 143 993 containerHttpPort: '80' environment: VERSION: $$cap_iredmail_version MLMMJADMIN_API_TOKEN: $$cap_gen_random_hex(32) ROUNDCUBE_DES_KEY: $$cap_gen_random_hex(24) FIRST_MAIL_DOMAIN: $$cap_root_domain HOSTNAME: $$cap_appname.$$cap_root_domain ADMIN_VERSION: $$cap_iredmail_admin_version FIRST_MAIL_DOMAIN_ADMIN_PASSWORD: $$cap_iredmail_default_password caproverOneClickApp: variables: - id: $$cap_iredmail_version label: iRedMail version tag description: >- Check out their Docker page for the valid tags https://hub.docker.com/r/iredmail/mariadb/tags defaultValue: stable - id: $$cap_iredmail_admin_version label: iRedMail Admin version tag description: >- Set 'NoChange' to stay by the docker image version OR Check out their GitHub page for the newest version https://github.com/iredmail/iRedAdmin/tags defaultValue: NoChange - id: $$cap_iredmail_default_password label: First Password description: >- Password for the admin login (you can change that later from the admin panel) defaultValue: $$cap_gen_random_hex(8) instructions: start: >- iRedMail is a free, open-source and full-featured mail server that allows you to host your own mail server at no cost. SMTP + IMAP + POP3 + Antispam & Antivirus + Web administration. **Requirements**: At least 4GB of ram and 5GB of rom. Recommended: Use 'mail' as the App Name. end: >- You **should** enable https to access the Admin panel and the Webmail safely. Admin panel: [$$cap_appname.$$cap_root_domain](//$$cap_appname.$$cap_root_domain), Webmail: [$$cap_appname.$$cap_root_domain/mail](//$$cap_appname.$$cap_root_domain/mail) Credentials: postmaster@$$cap_root_domain/$$cap_iredmail_default_password The deployment can take up to 5 minutes. displayName: iRedMail isOfficial: false description: iRedMail - Open Source Mail Server, built in one container documentation: Read the iRedMail documentation -> https://docs.iredmail.org/