prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Optimize Rainloop image
  ## Before you open your issue
  - [X] Check if no issue or pull-request for this already exists.
  - [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)
  - [X] You understand `Mailu` is made by volunteers in their **free time** — be conscise, civil and accept that delays can occur.
  - [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.
  
  ## Environment & Versions
  ### Environment
   - [X] docker-compose
   - [X] kubernetes
   - [X] docker swarm
  
  ### Versions
  Master
  ```
  $> docker images
  mailu/rainloop               master            2ad8d1c29ff3   45 hours ago     607MB
  ```
  Optimized version using NGINX:
  ```
  user/rainloop                master            7de9dee9286d   2 seconds ago   116MB
  ```
  
  ## Description
  In order to resolve issues #1830 and #1200, it is required to reduce build time, complexity and image size of images before multi-architecture builds can be supported. The current Rainloop image size is 607MB and can be optimized when changing from Apache to NGINX with officially supported Docker images. This can also increase overall web performance.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `webmails/rainloop/start.py`
  Content:
  ```
  1 #!/usr/bin/python3
  2 
  3 import os
  4 import shutil
  5 import logging as log
  6 import sys
  7 from socrate import system, conf
  8 
  9 log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
  10 
  11 # Actual startup script
  12 os.environ["FRONT_ADDRESS"] = system.resolve_address(os.environ.get("HOST_FRONT", "front"))
  13 os.environ["IMAP_ADDRESS"] = system.resolve_address(os.environ.get("HOST_IMAP", "imap"))
  14 
  15 os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))
  16 
  17 base = "/data/_data_/_default_/"
  18 shutil.rmtree(base + "domains/", ignore_errors=True)
  19 os.makedirs(base + "domains", exist_ok=True)
  20 os.makedirs(base + "configs", exist_ok=True)
  21 
  22 conf.jinja("/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
  23 conf.jinja("/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
  24 conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/rainloop.ini")
  25 
  26 os.system("chown -R www-data:www-data /data")
  27 os.system("chmod -R a+rX /var/www/html/")
  28 
  29 os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
  30 
  31
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py
  --- a/webmails/rainloop/start.py
  +++ b/webmails/rainloop/start.py
  @@ -19,12 +19,11 @@
   os.makedirs(base + "domains", exist_ok=True)
   os.makedirs(base + "configs", exist_ok=True)
   
  -conf.jinja("/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
  -conf.jinja("/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
  -conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/rainloop.ini")
  +conf.jinja("/defaults/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini")
  +conf.jinja("/defaults/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini")
  +conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini")
   
  -os.system("chown -R www-data:www-data /data")
  -os.system("chmod -R a+rX /var/www/html/")
  -
  -os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
  +os.system("chown -R nginx:nginx /data")
  +os.system("chmod -R a+rX /var/www/rainloop/")
   
  +os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
  
verification_info: {"golden_diff": "diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py\n--- a/webmails/rainloop/start.py\n+++ b/webmails/rainloop/start.py\n@@ -19,12 +19,11 @@\n os.makedirs(base + \"domains\", exist_ok=True)\n os.makedirs(base + \"configs\", exist_ok=True)\n \n-conf.jinja(\"/default.ini\", os.environ, \"/data/_data_/_default_/domains/default.ini\")\n-conf.jinja(\"/application.ini\", os.environ, \"/data/_data_/_default_/configs/application.ini\")\n-conf.jinja(\"/php.ini\", os.environ, \"/usr/local/etc/php/conf.d/rainloop.ini\")\n+conf.jinja(\"/defaults/default.ini\", os.environ, \"/data/_data_/_default_/domains/default.ini\")\n+conf.jinja(\"/defaults/application.ini\", os.environ, \"/data/_data_/_default_/configs/application.ini\")\n+conf.jinja(\"/defaults/php.ini\", os.environ, \"/etc/php7/php.ini\")\n \n-os.system(\"chown -R www-data:www-data /data\")\n-os.system(\"chmod -R a+rX /var/www/html/\")\n-\n-os.execv(\"/usr/local/bin/apache2-foreground\", [\"apache2-foreground\"])\n+os.system(\"chown -R nginx:nginx /data\")\n+os.system(\"chmod -R a+rX /var/www/rainloop/\")\n \n+os.execv(\"/usr/sbin/nginx\", [\"nginx\", \"-g\", \"daemon off;\"])\n", "issue": "Optimize Rainloop image\n## Before you open your issue\r\n- [X] Check if no issue or pull-request for this already exists.\r\n- [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)\r\n- [X] You understand `Mailu` is made by volunteers in their **free time** \u2014 be conscise, civil and accept that delays can occur.\r\n- [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.\r\n\r\n## Environment & Versions\r\n### Environment\r\n - [X] docker-compose\r\n - [X] kubernetes\r\n - [X] docker swarm\r\n\r\n### Versions\r\nMaster\r\n```\r\n$> docker images\r\nmailu/rainloop               master            2ad8d1c29ff3   45 hours ago     607MB\r\n```\r\nOptimized version using NGINX:\r\n```\r\nuser/rainloop                master            7de9dee9286d   2 seconds ago   116MB\r\n```\r\n\r\n## Description\r\nIn order to resolve issues #1830 and #1200, it is required to reduce build time, complexity and image size of images before multi-architecture builds can be supported. The current Rainloop image size is 607MB and can be optimized when changing from Apache to NGINX with officially supported Docker images. This can also increase overall web performance.\n", "before_files": [{"content": "#!/usr/bin/python3\n\nimport os\nimport shutil\nimport logging as log\nimport sys\nfrom socrate import system, conf\n\nlog.basicConfig(stream=sys.stderr, level=os.environ.get(\"LOG_LEVEL\", \"WARNING\"))\n\n# Actual startup script\nos.environ[\"FRONT_ADDRESS\"] = system.resolve_address(os.environ.get(\"HOST_FRONT\", \"front\"))\nos.environ[\"IMAP_ADDRESS\"] = system.resolve_address(os.environ.get(\"HOST_IMAP\", \"imap\"))\n\nos.environ[\"MAX_FILESIZE\"] = str(int(int(os.environ.get(\"MESSAGE_SIZE_LIMIT\"))*0.66/1048576))\n\nbase = \"/data/_data_/_default_/\"\nshutil.rmtree(base + \"domains/\", ignore_errors=True)\nos.makedirs(base + \"domains\", exist_ok=True)\nos.makedirs(base + \"configs\", exist_ok=True)\n\nconf.jinja(\"/default.ini\", os.environ, \"/data/_data_/_default_/domains/default.ini\")\nconf.jinja(\"/application.ini\", os.environ, \"/data/_data_/_default_/configs/application.ini\")\nconf.jinja(\"/php.ini\", os.environ, \"/usr/local/etc/php/conf.d/rainloop.ini\")\n\nos.system(\"chown -R www-data:www-data /data\")\nos.system(\"chmod -R a+rX /var/www/html/\")\n\nos.execv(\"/usr/local/bin/apache2-foreground\", [\"apache2-foreground\"])\n\n", "path": "webmails/rainloop/start.py"}], "after_files": [{"content": "#!/usr/bin/python3\n\nimport os\nimport shutil\nimport logging as log\nimport sys\nfrom socrate import system, conf\n\nlog.basicConfig(stream=sys.stderr, level=os.environ.get(\"LOG_LEVEL\", \"WARNING\"))\n\n# Actual startup script\nos.environ[\"FRONT_ADDRESS\"] = system.resolve_address(os.environ.get(\"HOST_FRONT\", \"front\"))\nos.environ[\"IMAP_ADDRESS\"] = system.resolve_address(os.environ.get(\"HOST_IMAP\", \"imap\"))\n\nos.environ[\"MAX_FILESIZE\"] = str(int(int(os.environ.get(\"MESSAGE_SIZE_LIMIT\"))*0.66/1048576))\n\nbase = \"/data/_data_/_default_/\"\nshutil.rmtree(base + \"domains/\", ignore_errors=True)\nos.makedirs(base + \"domains\", exist_ok=True)\nos.makedirs(base + \"configs\", exist_ok=True)\n\nconf.jinja(\"/defaults/default.ini\", os.environ, \"/data/_data_/_default_/domains/default.ini\")\nconf.jinja(\"/defaults/application.ini\", os.environ, \"/data/_data_/_default_/configs/application.ini\")\nconf.jinja(\"/defaults/php.ini\", os.environ, \"/etc/php7/php.ini\")\n\nos.system(\"chown -R nginx:nginx /data\")\nos.system(\"chmod -R a+rX /var/www/rainloop/\")\n\nos.execv(\"/usr/sbin/nginx\", [\"nginx\", \"-g\", \"daemon off;\"])\n", "path": "webmails/rainloop/start.py"}]}