[
  {
    "path": ".config/apache-pretty-urls.config.php",
    "content": "<?php\n$CONFIG = array (\n  'htaccess.RewriteBase' => '/',\n);\n"
  },
  {
    "path": ".config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": ".config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": ".config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": ".config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": ".config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": ".config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": ".config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": ".config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": ".config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": ".examples/README.md",
    "content": "# Examples section\n\nIn this subfolders are some examples how to use the docker image. There are two sections:\n\n * [`dockerfiles`](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles)\n * [`docker-compose`](https://github.com/nextcloud/docker/tree/master/.examples/docker-compose)\n\nThe `dockerfiles` are derived images, that add or alter certain functionalities of the default docker images. In the `docker-compose` subfolder are examples for deployment of the application, including database, redis, collabora and other services.\n\n## Dockerfiles\nThe Dockerfiles use the default images as base image and build on top of it.\n\n\nExample | Description\n------- | -------\n[cron](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed). This image runs `supervisord` to start nextcloud and cron as two seperate processes inside the container.\n[imap](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/imap) | adds dependencies required to authenticate users via imap\n[smb](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/smb) | adds dependencies required to use smb shares\n[full](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/full) | adds dependencies for ALL optional packages and cron functionality via supervisor (as in the `cron` example Dockerfile).\n\n### cron\nNOTE: [this container must run as root or `cron.php` will not run](https://github.com/nextcloud/docker/issues/1899).\n\n### full\nThe `full` Dockerfile example adds dependencies for all optional packages suggested by nextcloud that may be needed for some features (e.g. Video Preview Generation), as stated in the [Administration Manual](https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html).\n\nNOTE: The Dockerfile does not install the LibreOffice package (line is commented), because it would increase the generated Image size by approximately 500 MB. In order to install it, simply uncomment the appropriate line in the Dockerfile.\n\nNOTE: Per default, only previews for BMP, GIF, JPEG, MarkDown, MP3, PNG, TXT, and XBitmap Files are generated. The configuration of the preview generation can be done in config.php, as explained in the [Administration Manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#previews)\n\nNOTE: Nextcloud recommends [disabling preview generation](https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html#disable-preview-image-generation) for high security deployments, as preview generation opens your nextcloud instance to new possible attack vectors.\n\nThe required steps for each optional/recommended package that is not already in the Nextcloud image are listed here, so that the Dockerfile can easily be modified to only install the needed extra packages. Simply remove the steps for the unwanted packages from the Dockerfile.\n\n#### PHP Module bz2\n`docker-php-ext-install bz2`\n\n#### PHP Module imap\n`apt install libc-client-dev libkrb5-dev`\n`docker-php-ext-configure imap --with-kerberos --with-imap-ssl`\n`docker-php-ext-install imap`\n\n#### PHP Module gmp\n`apt install libgmp3-dev`\n`docker-php-ext-install gmp`\n\n#### PHP Module smbclient\n`apt install smbclient libsmbclient-dev`\n`pecl install smbclient`\n`docker-php-ext-enable smbclient`\n\n#### ffmpeg\n`apt install ffmpeg`\n\n#### LibreOffice\n`apt install libreoffice`\n\n#### CRON via supervisor\n`apt install supervisor`\n`mkdir /var/log/supervisord /var/run/supervisord`\nThe following Dockerfile commands are also necessary for a sucessfull cron installation:\n`COPY supervisord.conf /etc/supervisor/supervisord.conf`\n`CMD [\"/usr/bin/supervisord\"]`\n\n\n\n## docker-compose\nIn `docker-compose` additional services are bundled to create a complete nextcloud installation. The examples are designed to run out-of-the-box.\nBefore running the examples you have to modify the `db.env` and `compose.yaml` file and fill in your custom information.\n\nThe docker compose examples make heavily use of derived Dockerfiles to add configuration files into the containers. This way they should also work on remote docker systems as _Docker for Windows_. When running docker compose on the same host as the docker daemon, another possibility would be to simply mount the files in the volumes section in the `compose.yaml` file.\n\n\n### insecure\nThis example should only be used for testing on the local network because it uses a unencrypted http connection.\nWhen you want to have your server reachable from the internet adding HTTPS-encryption is mandatory!\nFor this use one of the [with-nginx-proxy](#with-nginx-proxy) examples.\n\nTo use this example complete the following steps:\n\n1. if you use mariadb or mysql choose a root password for the database in `compose.yaml` behind `MYSQL_ROOT_PASSWORD=`\n2. choose a password for the database user nextcloud in `db.env` behind `MYSQL_PASSWORD=` (for mariadb/mysql) or `POSTGRES_PASSWORD=` (for postgres)\n3. run `docker compose build --pull` to pull the most recent base images and build the custom dockerfiles\n4. start nextcloud with `docker compose up -d`\n\n\nIf you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.\n\n\n### with-nginx-proxy\nThe nginx proxy adds a proxy layer between nextcloud and the internet. The proxy is designed to serve multiple sites on the same host machine.\n\nThe advantage in adding this layer is the ability to add a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling.\nThis combination of the [nginxproxy/nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [nginxproxy/acme-companion](https://github.com/nginx-proxy/acme-companion) containers creates a fully automated https encryption of the nextcloud installation without worrying about certificate generation, validation or renewal.\n\n**This setup only works with a valid domain name on a server that is reachable from the internet.**\n\nTo use this example complete the following steps:\n\n1. open `compose.yaml`\n   1. insert your nextcloud domain behind `VIRTUAL_HOST=`and `LETSENCRYPT_HOST=`\n   2. enter a valid email behind `LETSENCRYPT_EMAIL=`\n   3. if you use mariadb or mysql choose a root password for the database behind `MYSQL_ROOT_PASSWORD=`\n2. choose a password for the database user nextcloud in `db.env` behind `MYSQL_PASSWORD=` (for mariadb/mysql) or `POSTGRES_PASSWORD=` (for postgres)\n3. run `docker compose build --pull` to pull the most recent base images and build the custom dockerfiles\n4. start nextcloud with `docker compose up -d`\n\n\nIf you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.\n"
  },
  {
    "path": ".examples/docker-compose/insecure/mariadb/apache/compose.yaml",
    "content": "---\nservices:\n  # Note: MariaDB is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    command: --transaction-isolation=READ-COMMITTED\n    restart: always\n    volumes:\n      - db:/var/lib/mysql:Z\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MARIADB_AUTO_UPGRADE=1\n      - MARIADB_DISABLE_UPGRADE_BACKUP=1\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:apache\n    restart: always\n    ports:\n      - 127.0.0.1:8080:80\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - MYSQL_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n\n  cron:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\nvolumes:\n  db:\n  nextcloud:\n"
  },
  {
    "path": ".examples/docker-compose/insecure/mariadb/apache/db.env",
    "content": "MYSQL_PASSWORD=\nMYSQL_DATABASE=nextcloud\nMYSQL_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/insecure/mariadb/fpm/compose.yaml",
    "content": "---\nservices:\n  # Note: MariaDB is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    command: --transaction-isolation=READ-COMMITTED\n    restart: always\n    volumes:\n      - db:/var/lib/mysql:Z\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MARIADB_AUTO_UPGRADE=1\n      - MARIADB_DISABLE_UPGRADE_BACKUP=1\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - MYSQL_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/nginx/\n  web:\n    image: nginx:alpine-slim\n    restart: always\n    ports:\n      - 127.0.0.1:8080:80\n    volumes:\n      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html\n      - ./web/nginx.conf:/etc/nginx/nginx.conf:ro\n      # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)\n      - nextcloud:/var/www/html:z,ro\n    depends_on:\n      - app\n\n  cron:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\nvolumes:\n  db:\n  nextcloud:\n"
  },
  {
    "path": ".examples/docker-compose/insecure/mariadb/fpm/db.env",
    "content": "MYSQL_PASSWORD=\nMYSQL_DATABASE=nextcloud\nMYSQL_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/insecure/mariadb/fpm/web/nginx.conf",
    "content": "worker_processes auto;\n\nerror_log  /var/log/nginx/error.log warn;\npid        /var/run/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include mime.types;\n    default_type  application/octet-stream;\n    types {\n        text/javascript mjs;\n    }\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  /var/log/nginx/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    # Prevent nginx HTTP Server Detection\n    server_tokens   off;\n\n    keepalive_timeout  65;\n\n    # Set the `immutable` cache control options only for assets with a cache busting `v` argument\n    map $arg_v $asset_immutable {\n        \"\" \"\";\n    default \", immutable\";\n    }\n\n    #gzip  on;\n\n    resolver 127.0.0.11 valid=2s;\n    upstream php-handler {\n        zone backends 64k;\n        server app:9000 resolve;\n    }\n\n    server {\n        listen 80;\n\n        # HSTS settings\n        # WARNING: Only add the preload option once you read about\n        # the consequences in https://hstspreload.org/. This option\n        # will add the domain to a hardcoded list that is shipped\n        # in all major browsers and getting removed from this list\n        # could take several months.\n        #add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains; preload;\" always;\n\n        # set max upload size and increase upload timeout:\n        client_max_body_size 512M;\n        client_body_timeout 300s;\n        fastcgi_buffers 64 4K;\n\n        # The settings allows you to optimize the HTTP2 bandwidth.\n        # See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/\n        # for tuning hints\n        client_body_buffer_size 512k;\n\n        # Enable gzip but do not remove ETag headers\n        gzip on;\n        gzip_vary on;\n        gzip_comp_level 4;\n        gzip_min_length 256;\n        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;\n        gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;\n\n        # Pagespeed is not supported by Nextcloud, so if your server is built\n        # with the `ngx_pagespeed` module, uncomment this line to disable it.\n        #pagespeed off;\n\n        # HTTP response headers borrowed from Nextcloud `.htaccess`\n        add_header Referrer-Policy                      \"no-referrer\"       always;\n        add_header X-Content-Type-Options               \"nosniff\"           always;\n        add_header X-Frame-Options                      \"SAMEORIGIN\"        always;\n        add_header X-Permitted-Cross-Domain-Policies    \"none\"              always;\n        add_header X-Robots-Tag                         \"noindex, nofollow\" always;\n\n        # Remove X-Powered-By, which is an information leak\n        fastcgi_hide_header X-Powered-By;\n\n        # Path to the root of your installation\n        root /var/www/html;\n\n        # Specify how to handle directories -- specifying `/index.php$request_uri`\n        # here as the fallback means that Nginx always exhibits the desired behaviour\n        # when a client requests a path that corresponds to a directory that exists\n        # on the server. In particular, if that directory contains an index.php file,\n        # that file is correctly served; if it doesn't, then the request is passed to\n        # the front-end controller. This consistent behaviour means that we don't need\n        # to specify custom rules for certain paths (e.g. images and other assets,\n        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus\n        # `try_files $uri $uri/ /index.php$request_uri`\n        # always provides the desired behaviour.\n        index index.php index.html /index.php$request_uri;\n\n        # Rule borrowed from `.htaccess` to handle Microsoft DAV clients\n        location = / {\n            if ( $http_user_agent ~ ^DavClnt ) {\n                return 302 /remote.php/webdav/$is_args$args;\n            }\n        }\n\n        location = /robots.txt {\n            allow all;\n            log_not_found off;\n            access_log off;\n        }\n\n        # Make a regex exception for `/.well-known` so that clients can still\n        # access it despite the existence of the regex rule\n        # `location ~ /(\\.|autotest|...)` which would otherwise handle requests\n        # for `/.well-known`.\n        location ^~ /.well-known {\n            # The rules in this block are an adaptation of the rules\n            # in `.htaccess` that concern `/.well-known`.\n\n            location = /.well-known/carddav { return 301 /remote.php/dav/; }\n            location = /.well-known/caldav  { return 301 /remote.php/dav/; }\n\n            location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }\n            location /.well-known/pki-validation    { try_files $uri $uri/ =404; }\n\n            # Let Nextcloud's API for `/.well-known` URIs handle all other\n            # requests by passing them to the front-end controller.\n            return 301 /index.php$request_uri;\n        }\n\n        # Rules borrowed from `.htaccess` to hide certain paths from clients\n        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }\n        location ~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)                { return 404; }\n\n        # Ensure this block, which passes PHP files to the PHP process, is above the blocks\n        # which handle static assets (as seen below). If this block is not declared first,\n        # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`\n        # to the URI, resulting in a HTTP 500 error response.\n        location ~ \\.php(?:$|/) {\n            # Required for legacy support\n            rewrite ^/(?!index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|.+\\/richdocumentscode(_arm64)?\\/proxy) /index.php$request_uri;\n\n            fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n            set $path_info $fastcgi_path_info;\n\n            try_files $fastcgi_script_name =404;\n\n            include fastcgi_params;\n            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n            fastcgi_param PATH_INFO $path_info;\n            #fastcgi_param HTTPS on;\n\n            fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice\n            fastcgi_param front_controller_active true;     # Enable pretty urls\n            fastcgi_pass php-handler;\n\n            fastcgi_intercept_errors on;\n            fastcgi_request_buffering on;                   # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header.\n\n            fastcgi_max_temp_file_size 0;\n        }\n\n        # Serve static files\n        location ~ \\.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {\n            try_files $uri /index.php$request_uri;\n            add_header Cache-Control \"public, max-age=15778463$asset_immutable\";\n            add_header Referrer-Policy                   \"no-referrer\"       always;\n            add_header X-Content-Type-Options            \"nosniff\"           always;\n            add_header X-Frame-Options                   \"SAMEORIGIN\"        always;\n            add_header X-Permitted-Cross-Domain-Policies \"none\"              always;\n            add_header X-Robots-Tag                      \"noindex, nofollow\" always;\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        location ~ \\.(otf|woff2?)$ {\n            try_files $uri /index.php$request_uri;\n            expires 7d;         # Cache-Control policy borrowed from `.htaccess`\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        # Rule borrowed from `.htaccess`\n        location /remote {\n            return 301 /remote.php$request_uri;\n        }\n\n        location / {\n            try_files $uri $uri/ /index.php$request_uri;\n        }\n    }\n}\n"
  },
  {
    "path": ".examples/docker-compose/insecure/postgres/apache/compose.yaml",
    "content": "---\nservices:\n  # Note: PostgreSQL is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/postgres\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: postgres:alpine\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data:Z\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:apache\n    restart: always\n    ports:\n      - 127.0.0.1:8080:80\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - POSTGRES_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n\n  cron:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\nvolumes:\n  db:\n  nextcloud:\n"
  },
  {
    "path": ".examples/docker-compose/insecure/postgres/apache/db.env",
    "content": "POSTGRES_PASSWORD=\nPOSTGRES_DB=nextcloud\nPOSTGRES_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/insecure/postgres/fpm/compose.yaml",
    "content": "---\nservices:\n  # Note: PostgreSQL is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/postgres\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: postgres:alpine\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data:Z\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - POSTGRES_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/nginx/\n  web:\n    image: nginx:alpine-slim\n    restart: always\n    ports:\n      - 127.0.0.1:8080:80\n    volumes:\n      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html\n      - ./web/nginx.conf:/etc/nginx/nginx.conf:ro\n      # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)\n      - nextcloud:/var/www/html:z,ro\n    depends_on:\n      - app\n\n  cron:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\nvolumes:\n  db:\n  nextcloud:\n"
  },
  {
    "path": ".examples/docker-compose/insecure/postgres/fpm/db.env",
    "content": "POSTGRES_PASSWORD=\nPOSTGRES_DB=nextcloud\nPOSTGRES_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/insecure/postgres/fpm/web/nginx.conf",
    "content": "worker_processes auto;\n\nerror_log  /var/log/nginx/error.log warn;\npid        /var/run/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include mime.types;\n    default_type  application/octet-stream;\n    types {\n        text/javascript mjs;\n    }\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  /var/log/nginx/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    # Prevent nginx HTTP Server Detection\n    server_tokens   off;\n\n    keepalive_timeout  65;\n\n    # Set the `immutable` cache control options only for assets with a cache busting `v` argument\n    map $arg_v $asset_immutable {\n        \"\" \"\";\n    default \", immutable\";\n    }\n\n    #gzip  on;\n\n    resolver 127.0.0.11 valid=2s;\n    upstream php-handler {\n        zone backends 64k;\n        server app:9000 resolve;\n    }\n\n    server {\n        listen 80;\n\n        # HSTS settings\n        # WARNING: Only add the preload option once you read about\n        # the consequences in https://hstspreload.org/. This option\n        # will add the domain to a hardcoded list that is shipped\n        # in all major browsers and getting removed from this list\n        # could take several months.\n        #add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains; preload;\" always;\n\n        # set max upload size and increase upload timeout:\n        client_max_body_size 512M;\n        client_body_timeout 300s;\n        fastcgi_buffers 64 4K;\n\n        # The settings allows you to optimize the HTTP2 bandwidth.\n        # See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/\n        # for tuning hints\n        client_body_buffer_size 512k;\n\n        # Enable gzip but do not remove ETag headers\n        gzip on;\n        gzip_vary on;\n        gzip_comp_level 4;\n        gzip_min_length 256;\n        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;\n        gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;\n\n        # Pagespeed is not supported by Nextcloud, so if your server is built\n        # with the `ngx_pagespeed` module, uncomment this line to disable it.\n        #pagespeed off;\n\n        # HTTP response headers borrowed from Nextcloud `.htaccess`\n        add_header Referrer-Policy                      \"no-referrer\"       always;\n        add_header X-Content-Type-Options               \"nosniff\"           always;\n        add_header X-Frame-Options                      \"SAMEORIGIN\"        always;\n        add_header X-Permitted-Cross-Domain-Policies    \"none\"              always;\n        add_header X-Robots-Tag                         \"noindex, nofollow\" always;\n\n        # Remove X-Powered-By, which is an information leak\n        fastcgi_hide_header X-Powered-By;\n\n        # Path to the root of your installation\n        root /var/www/html;\n\n        # Specify how to handle directories -- specifying `/index.php$request_uri`\n        # here as the fallback means that Nginx always exhibits the desired behaviour\n        # when a client requests a path that corresponds to a directory that exists\n        # on the server. In particular, if that directory contains an index.php file,\n        # that file is correctly served; if it doesn't, then the request is passed to\n        # the front-end controller. This consistent behaviour means that we don't need\n        # to specify custom rules for certain paths (e.g. images and other assets,\n        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus\n        # `try_files $uri $uri/ /index.php$request_uri`\n        # always provides the desired behaviour.\n        index index.php index.html /index.php$request_uri;\n\n        # Rule borrowed from `.htaccess` to handle Microsoft DAV clients\n        location = / {\n            if ( $http_user_agent ~ ^DavClnt ) {\n                return 302 /remote.php/webdav/$is_args$args;\n            }\n        }\n\n        location = /robots.txt {\n            allow all;\n            log_not_found off;\n            access_log off;\n        }\n\n        # Make a regex exception for `/.well-known` so that clients can still\n        # access it despite the existence of the regex rule\n        # `location ~ /(\\.|autotest|...)` which would otherwise handle requests\n        # for `/.well-known`.\n        location ^~ /.well-known {\n            # The rules in this block are an adaptation of the rules\n            # in `.htaccess` that concern `/.well-known`.\n\n            location = /.well-known/carddav { return 301 /remote.php/dav/; }\n            location = /.well-known/caldav  { return 301 /remote.php/dav/; }\n\n            location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }\n            location /.well-known/pki-validation    { try_files $uri $uri/ =404; }\n\n            # Let Nextcloud's API for `/.well-known` URIs handle all other\n            # requests by passing them to the front-end controller.\n            return 301 /index.php$request_uri;\n        }\n\n        # Rules borrowed from `.htaccess` to hide certain paths from clients\n        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }\n        location ~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)                { return 404; }\n\n        # Ensure this block, which passes PHP files to the PHP process, is above the blocks\n        # which handle static assets (as seen below). If this block is not declared first,\n        # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`\n        # to the URI, resulting in a HTTP 500 error response.\n        location ~ \\.php(?:$|/) {\n            # Required for legacy support\n            rewrite ^/(?!index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|.+\\/richdocumentscode(_arm64)?\\/proxy) /index.php$request_uri;\n\n            fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n            set $path_info $fastcgi_path_info;\n\n            try_files $fastcgi_script_name =404;\n\n            include fastcgi_params;\n            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n            fastcgi_param PATH_INFO $path_info;\n            #fastcgi_param HTTPS on;\n\n            fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice\n            fastcgi_param front_controller_active true;     # Enable pretty urls\n            fastcgi_pass php-handler;\n\n            fastcgi_intercept_errors on;\n            fastcgi_request_buffering on;                   # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header.\n\n            fastcgi_max_temp_file_size 0;\n        }\n\n        # Serve static files\n        location ~ \\.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {\n            try_files $uri /index.php$request_uri;\n            add_header Cache-Control \"public, max-age=15778463$asset_immutable\";\n            add_header Referrer-Policy                   \"no-referrer\"       always;\n            add_header X-Content-Type-Options            \"nosniff\"           always;\n            add_header X-Frame-Options                   \"SAMEORIGIN\"        always;\n            add_header X-Permitted-Cross-Domain-Policies \"none\"              always;\n            add_header X-Robots-Tag                      \"noindex, nofollow\" always;\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        location ~ \\.(otf|woff2?)$ {\n            try_files $uri /index.php$request_uri;\n            expires 7d;         # Cache-Control policy borrowed from `.htaccess`\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        # Rule borrowed from `.htaccess`\n        location /remote {\n            return 301 /remote.php$request_uri;\n        }\n\n        location / {\n            try_files $uri $uri/ /index.php$request_uri;\n        }\n    }\n}\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/apache/compose.yaml",
    "content": "---\nservices:\n  # Note: MariaDB is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    command: --transaction-isolation=READ-COMMITTED\n    restart: always\n    volumes:\n      - db:/var/lib/mysql:Z\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MARIADB_AUTO_UPGRADE=1\n      - MARIADB_DISABLE_UPGRADE_BACKUP=1\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - VIRTUAL_HOST=\n      - LETSENCRYPT_HOST=\n      - LETSENCRYPT_EMAIL=\n      - MYSQL_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n      - proxy\n    networks:\n      - proxy-tier\n      - default\n\n  cron:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx-proxy is an external service. You can find more information about the configuration here:\n  # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.\n  # https://hub.docker.com/r/nginxproxy/nginx-proxy\n  proxy:\n    build: ./proxy\n    restart: always\n    ports:\n      - 80:80\n      - 443:443\n    labels:\n      - \"com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy\"\n    volumes:\n      - certs:/etc/nginx/certs:ro,z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - dhparam:/etc/nginx/dhparam:z\n      - /var/run/docker.sock:/tmp/docker.sock:z,ro\n    networks:\n      - proxy-tier\n\n  # Note: Letsencrypt companion is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/r/nginxproxy/acme-companion\n  letsencrypt-companion:\n    image: nginxproxy/acme-companion\n    restart: always\n    environment:\n      - DEFAULT_EMAIL=\n    volumes:\n      - certs:/etc/nginx/certs:z\n      - acme:/etc/acme.sh:z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/var/run/docker.sock:z,ro\n    networks:\n      - proxy-tier\n    depends_on:\n      - proxy\n\n# self signed,outdated\n#  omgwtfssl:\n#    image: paulczar/omgwtfssl\n#    restart: \"no\"\n#    volumes:\n#      - certs:/certs\n#    environment:\n#      - SSL_SUBJECT=servhostname.local\n#      - CA_SUBJECT=my@example.com\n#      - SSL_KEY=/certs/servhostname.local.key\n#      - SSL_CSR=/certs/servhostname.local.csr\n#      - SSL_CERT=/certs/servhostname.local.crt\n#    networks:\n#      - proxy-tier\n\nvolumes:\n  db:\n  nextcloud:\n  certs:\n  acme:\n  vhost.d:\n  html:\n  dhparam:\n\nnetworks:\n  proxy-tier:\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/apache/db.env",
    "content": "MYSQL_PASSWORD=\nMYSQL_DATABASE=nextcloud\nMYSQL_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/apache/proxy/Dockerfile",
    "content": "FROM nginxproxy/nginx-proxy:1.7-alpine\n\nCOPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/apache/proxy/uploadsize.conf",
    "content": "client_max_body_size 10G;\nproxy_request_buffering off;\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/fpm/compose.yaml",
    "content": "---\nservices:\n  # Note: MariaDB is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    command: --transaction-isolation=READ-COMMITTED\n    restart: always\n    volumes:\n      - db:/var/lib/mysql:Z\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MARIADB_AUTO_UPGRADE=1\n      - MARIADB_DISABLE_UPGRADE_BACKUP=1\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - MYSQL_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n      - proxy\n\n  # Note: Nginx is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/nginx/\n  web:\n    image: nginx:alpine-slim\n    restart: always\n    volumes:\n      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html\n      - ./web/nginx.conf:/etc/nginx/nginx.conf:ro\n      # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)\n      - nextcloud:/var/www/html:z,ro\n    environment:\n      - VIRTUAL_HOST=\n      - LETSENCRYPT_HOST=\n      - LETSENCRYPT_EMAIL=\n    depends_on:\n      - app\n    networks:\n      - proxy-tier\n      - default\n\n  cron:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx-proxy is an external service. You can find more information about the configuration here:\n  # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.\n  # https://hub.docker.com/r/nginxproxy/nginx-proxy\n  proxy:\n    build: ./proxy\n    restart: always\n    ports:\n      - 80:80\n      - 443:443\n    labels:\n      - \"com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy\"\n    volumes:\n      - certs:/etc/nginx/certs:z,ro\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/tmp/docker.sock:z,ro\n    networks:\n      - proxy-tier\n\n  # Note: Letsencrypt companion is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/r/nginxproxy/acme-companion\n  letsencrypt-companion:\n    image: nginxproxy/acme-companion\n    restart: always\n    environment:\n      - DEFAULT_EMAIL=\n    volumes:\n      - certs:/etc/nginx/certs:z\n      - acme:/etc/acme.sh:z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/var/run/docker.sock:z,ro\n    networks:\n      - proxy-tier\n    depends_on:\n      - proxy\n\n# self signed, outdated.\n#  omgwtfssl:\n#    image: paulczar/omgwtfssl\n#    restart: \"no\"\n#    volumes:\n#      - certs:/certs\n#    environment:\n#      - SSL_SUBJECT=servhostname.local\n#      - CA_SUBJECT=my@example.com\n#      - SSL_KEY=/certs/servhostname.local.key\n#      - SSL_CSR=/certs/servhostname.local.csr\n#      - SSL_CERT=/certs/servhostname.local.crt\n#    networks:\n#      - proxy-tier\n\nvolumes:\n  db:\n  nextcloud:\n  certs:\n  acme:\n  vhost.d:\n  html:\n\nnetworks:\n  proxy-tier:\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/fpm/db.env",
    "content": "MYSQL_PASSWORD=\nMYSQL_DATABASE=nextcloud\nMYSQL_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/fpm/proxy/Dockerfile",
    "content": "FROM nginxproxy/nginx-proxy:1.7-alpine\n\nCOPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/fpm/proxy/uploadsize.conf",
    "content": "client_max_body_size 10G;\nproxy_request_buffering off;\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf",
    "content": "worker_processes auto;\n\nerror_log  /var/log/nginx/error.log warn;\npid        /var/run/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include mime.types;\n    default_type  application/octet-stream;\n    types {\n        text/javascript mjs;\n    }\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  /var/log/nginx/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    # Prevent nginx HTTP Server Detection\n    server_tokens   off;\n\n    keepalive_timeout  65;\n\n    # Set the `immutable` cache control options only for assets with a cache busting `v` argument\n    map $arg_v $asset_immutable {\n        \"\" \"\";\n    default \", immutable\";\n    }\n\n    #gzip  on;\n\n    resolver 127.0.0.11 valid=2s;\n    upstream php-handler {\n        zone backends 64k;\n        server app:9000 resolve;\n    }\n\n    server {\n        listen 80;\n\n        # HSTS settings\n        # WARNING: Only add the preload option once you read about\n        # the consequences in https://hstspreload.org/. This option\n        # will add the domain to a hardcoded list that is shipped\n        # in all major browsers and getting removed from this list\n        # could take several months.\n        #add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains; preload;\" always;\n\n        # set max upload size and increase upload timeout:\n        client_max_body_size 512M;\n        client_body_timeout 300s;\n        fastcgi_buffers 64 4K;\n\n        # The settings allows you to optimize the HTTP2 bandwidth.\n        # See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/\n        # for tuning hints\n        client_body_buffer_size 512k;\n\n        # Enable gzip but do not remove ETag headers\n        gzip on;\n        gzip_vary on;\n        gzip_comp_level 4;\n        gzip_min_length 256;\n        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;\n        gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;\n\n        # Pagespeed is not supported by Nextcloud, so if your server is built\n        # with the `ngx_pagespeed` module, uncomment this line to disable it.\n        #pagespeed off;\n\n        # HTTP response headers borrowed from Nextcloud `.htaccess`\n        add_header Referrer-Policy                      \"no-referrer\"       always;\n        add_header X-Content-Type-Options               \"nosniff\"           always;\n        add_header X-Frame-Options                      \"SAMEORIGIN\"        always;\n        add_header X-Permitted-Cross-Domain-Policies    \"none\"              always;\n        add_header X-Robots-Tag                         \"noindex, nofollow\" always;\n\n        # Remove X-Powered-By, which is an information leak\n        fastcgi_hide_header X-Powered-By;\n\n        # Path to the root of your installation\n        root /var/www/html;\n\n        # Specify how to handle directories -- specifying `/index.php$request_uri`\n        # here as the fallback means that Nginx always exhibits the desired behaviour\n        # when a client requests a path that corresponds to a directory that exists\n        # on the server. In particular, if that directory contains an index.php file,\n        # that file is correctly served; if it doesn't, then the request is passed to\n        # the front-end controller. This consistent behaviour means that we don't need\n        # to specify custom rules for certain paths (e.g. images and other assets,\n        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus\n        # `try_files $uri $uri/ /index.php$request_uri`\n        # always provides the desired behaviour.\n        index index.php index.html /index.php$request_uri;\n\n        # Rule borrowed from `.htaccess` to handle Microsoft DAV clients\n        location = / {\n            if ( $http_user_agent ~ ^DavClnt ) {\n                return 302 /remote.php/webdav/$is_args$args;\n            }\n        }\n\n        location = /robots.txt {\n            allow all;\n            log_not_found off;\n            access_log off;\n        }\n\n        # Make a regex exception for `/.well-known` so that clients can still\n        # access it despite the existence of the regex rule\n        # `location ~ /(\\.|autotest|...)` which would otherwise handle requests\n        # for `/.well-known`.\n        location ^~ /.well-known {\n            # The rules in this block are an adaptation of the rules\n            # in `.htaccess` that concern `/.well-known`.\n\n            location = /.well-known/carddav { return 301 /remote.php/dav/; }\n            location = /.well-known/caldav  { return 301 /remote.php/dav/; }\n\n            location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }\n            location /.well-known/pki-validation    { try_files $uri $uri/ =404; }\n\n            # Let Nextcloud's API for `/.well-known` URIs handle all other\n            # requests by passing them to the front-end controller.\n            return 301 /index.php$request_uri;\n        }\n\n        # Rules borrowed from `.htaccess` to hide certain paths from clients\n        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }\n        location ~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)                { return 404; }\n\n        # Ensure this block, which passes PHP files to the PHP process, is above the blocks\n        # which handle static assets (as seen below). If this block is not declared first,\n        # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`\n        # to the URI, resulting in a HTTP 500 error response.\n        location ~ \\.php(?:$|/) {\n            # Required for legacy support\n            rewrite ^/(?!index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|.+\\/richdocumentscode(_arm64)?\\/proxy) /index.php$request_uri;\n\n            fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n            set $path_info $fastcgi_path_info;\n\n            try_files $fastcgi_script_name =404;\n\n            include fastcgi_params;\n            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n            fastcgi_param PATH_INFO $path_info;\n            fastcgi_param HTTPS on;\n\n            fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice\n            fastcgi_param front_controller_active true;     # Enable pretty urls\n            fastcgi_pass php-handler;\n\n            fastcgi_intercept_errors on;\n            fastcgi_request_buffering on;                   # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header.\n\n            fastcgi_max_temp_file_size 0;\n        }\n\n        # Serve static files\n        location ~ \\.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {\n            try_files $uri /index.php$request_uri;\n            add_header Cache-Control \"public, max-age=15778463$asset_immutable\";\n            add_header Referrer-Policy                   \"no-referrer\"       always;\n            add_header X-Content-Type-Options            \"nosniff\"           always;\n            add_header X-Frame-Options                   \"SAMEORIGIN\"        always;\n            add_header X-Permitted-Cross-Domain-Policies \"none\"              always;\n            add_header X-Robots-Tag                      \"noindex, nofollow\" always;\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        location ~ \\.(otf|woff2?)$ {\n            try_files $uri /index.php$request_uri;\n            expires 7d;         # Cache-Control policy borrowed from `.htaccess`\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        # Rule borrowed from `.htaccess`\n        location /remote {\n            return 301 /remote.php$request_uri;\n        }\n\n        location / {\n            try_files $uri $uri/ /index.php$request_uri;\n        }\n    }\n}\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/apache/compose.yaml",
    "content": "---\nservices:\n  # Note: PostgreSQL is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/postgres\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: postgres:alpine\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data:Z\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - VIRTUAL_HOST=\n      - LETSENCRYPT_HOST=\n      - LETSENCRYPT_EMAIL=\n      - POSTGRES_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n      - proxy\n    networks:\n      - proxy-tier\n      - default\n\n  cron:\n    image: nextcloud:apache\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx-proxy is an external service. You can find more information about the configuration here:\n  # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.\n  # https://hub.docker.com/r/nginxproxy/nginx-proxy\n  proxy:\n    build: ./proxy\n    restart: always\n    ports:\n      - 80:80\n      - 443:443\n    labels:\n      - \"com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy\"\n    volumes:\n      - certs:/etc/nginx/certs:ro,z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/tmp/docker.sock:z,ro\n    networks:\n      - proxy-tier\n\n  # Note: Letsencrypt companion is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/r/nginxproxy/acme-companion\n  letsencrypt-companion:\n    image: nginxproxy/acme-companion\n    restart: always\n    volumes:\n      - certs:/etc/nginx/certs:z\n      - acme:/etc/acme.sh:z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/var/run/docker.sock:z,ro\n    networks:\n      - proxy-tier\n    depends_on:\n      - proxy\n\n# self signed, outdated\n#  omgwtfssl:\n#    image: paulczar/omgwtfssl\n#    restart: \"no\"\n#    volumes:\n#      - certs:/certs\n#    environment:\n#      - SSL_SUBJECT=servhostname.local\n#      - CA_SUBJECT=my@example.com\n#      - SSL_KEY=/certs/servhostname.local.key\n#      - SSL_CSR=/certs/servhostname.local.csr\n#      - SSL_CERT=/certs/servhostname.local.crt\n#    networks:\n#      - proxy-tier\n\nvolumes:\n  db:\n  nextcloud:\n  certs:\n  acme:\n  vhost.d:\n  html:\n\nnetworks:\n  proxy-tier:\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/apache/db.env",
    "content": "POSTGRES_PASSWORD=\nPOSTGRES_DB=nextcloud\nPOSTGRES_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/apache/proxy/Dockerfile",
    "content": "FROM nginxproxy/nginx-proxy:1.7-alpine\n\nCOPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/apache/proxy/uploadsize.conf",
    "content": "client_max_body_size 10G;\nproxy_request_buffering off;\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/fpm/compose.yaml",
    "content": "---\nservices:\n  # Note: PostgreSQL is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/postgres\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: postgres:alpine\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data:Z\n    env_file:\n      - db.env\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    environment:\n      - POSTGRES_HOST=db\n      - REDIS_HOST=redis\n    env_file:\n      - db.env\n    depends_on:\n      - db\n      - redis\n      - proxy\n\n  # Note: Nginx is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/nginx/\n  web:\n    image: nginx:alpine-slim\n    restart: always\n    volumes:\n      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html\n      - ./web/nginx.conf:/etc/nginx/nginx.conf:ro\n      # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)\n      - nextcloud:/var/www/html:z,ro\n    environment:\n      - VIRTUAL_HOST=\n      - LETSENCRYPT_HOST=\n      - LETSENCRYPT_EMAIL=\n    depends_on:\n      - app\n    networks:\n      - proxy-tier\n      - default\n\n  cron:\n    image: nextcloud:fpm-alpine\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html:z\n      # NOTE: The `volumes` config of the `cron` and `app` containers must match\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n      - redis\n\n  # Note: Nginx-proxy is an external service. You can find more information about the configuration here:\n  # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.\n  # https://hub.docker.com/r/nginxproxy/nginx-proxy\n  proxy:\n    build: ./proxy\n    restart: always\n    ports:\n      - 80:80\n      - 443:443\n    labels:\n      - \"com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy\"\n    volumes:\n      - certs:/etc/nginx/certs:z,ro\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/tmp/docker.sock:z,ro\n    networks:\n      - proxy-tier\n\n  # Note: Letsencrypt companion is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/r/nginxproxy/acme-companion\n  letsencrypt-companion:\n    image: nginxproxy/acme-companion\n    restart: always\n    volumes:\n      - certs:/etc/nginx/certs:z\n      - acme:/etc/acme.sh:z\n      - vhost.d:/etc/nginx/vhost.d:z\n      - html:/usr/share/nginx/html:z\n      - /var/run/docker.sock:/var/run/docker.sock:z,ro\n    environment:\n      - DEFAULT_EMAIL=\n    networks:\n      - proxy-tier\n    depends_on:\n      - proxy\n\n# self signed, outdated\n#  omgwtfssl:\n#    image: paulczar/omgwtfssl\n#    restart: \"no\"\n#    volumes:\n#      - certs:/certs\n#    environment:\n#      - SSL_SUBJECT=servhostname.local\n#      - CA_SUBJECT=my@example.com\n#      - SSL_KEY=/certs/servhostname.local.key\n#      - SSL_CSR=/certs/servhostname.local.csr\n#      - SSL_CERT=/certs/servhostname.local.crt\n#    networks:\n#      - proxy-tier\n\nvolumes:\n  db:\n  nextcloud:\n  certs:\n  acme:\n  vhost.d:\n  html:\n\nnetworks:\n  proxy-tier:\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/fpm/db.env",
    "content": "POSTGRES_PASSWORD=\nPOSTGRES_DB=nextcloud\nPOSTGRES_USER=nextcloud\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/fpm/proxy/Dockerfile",
    "content": "FROM nginxproxy/nginx-proxy:1.7-alpine\n\nCOPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/fpm/proxy/uploadsize.conf",
    "content": "client_max_body_size 10G;\nproxy_request_buffering off;\n"
  },
  {
    "path": ".examples/docker-compose/with-nginx-proxy/postgres/fpm/web/nginx.conf",
    "content": "worker_processes auto;\n\nerror_log  /var/log/nginx/error.log warn;\npid        /var/run/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include mime.types;\n    default_type  application/octet-stream;\n    types {\n        text/javascript mjs;\n    }\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  /var/log/nginx/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    # Prevent nginx HTTP Server Detection\n    server_tokens   off;\n\n    keepalive_timeout  65;\n\n    # Set the `immutable` cache control options only for assets with a cache busting `v` argument\n    map $arg_v $asset_immutable {\n        \"\" \"\";\n    default \", immutable\";\n    }\n\n    #gzip  on;\n\n    resolver 127.0.0.11 valid=2s;\n    upstream php-handler {\n        zone backends 64k;\n        server app:9000 resolve;\n    }\n\n    server {\n        listen 80;\n\n        # HSTS settings\n        # WARNING: Only add the preload option once you read about\n        # the consequences in https://hstspreload.org/. This option\n        # will add the domain to a hardcoded list that is shipped\n        # in all major browsers and getting removed from this list\n        # could take several months.\n        #add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains; preload;\" always;\n\n        # set max upload size and increase upload timeout:\n        client_max_body_size 512M;\n        client_body_timeout 300s;\n        fastcgi_buffers 64 4K;\n\n        # The settings allows you to optimize the HTTP2 bandwidth.\n        # See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/\n        # for tuning hints\n        client_body_buffer_size 512k;\n\n        # Enable gzip but do not remove ETag headers\n        gzip on;\n        gzip_vary on;\n        gzip_comp_level 4;\n        gzip_min_length 256;\n        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;\n        gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;\n\n        # Pagespeed is not supported by Nextcloud, so if your server is built\n        # with the `ngx_pagespeed` module, uncomment this line to disable it.\n        #pagespeed off;\n\n        # HTTP response headers borrowed from Nextcloud `.htaccess`\n        add_header Referrer-Policy                      \"no-referrer\"       always;\n        add_header X-Content-Type-Options               \"nosniff\"           always;\n        add_header X-Frame-Options                      \"SAMEORIGIN\"        always;\n        add_header X-Permitted-Cross-Domain-Policies    \"none\"              always;\n        add_header X-Robots-Tag                         \"noindex, nofollow\" always;\n\n        # Remove X-Powered-By, which is an information leak\n        fastcgi_hide_header X-Powered-By;\n\n        # Path to the root of your installation\n        root /var/www/html;\n\n        # Specify how to handle directories -- specifying `/index.php$request_uri`\n        # here as the fallback means that Nginx always exhibits the desired behaviour\n        # when a client requests a path that corresponds to a directory that exists\n        # on the server. In particular, if that directory contains an index.php file,\n        # that file is correctly served; if it doesn't, then the request is passed to\n        # the front-end controller. This consistent behaviour means that we don't need\n        # to specify custom rules for certain paths (e.g. images and other assets,\n        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus\n        # `try_files $uri $uri/ /index.php$request_uri`\n        # always provides the desired behaviour.\n        index index.php index.html /index.php$request_uri;\n\n        # Rule borrowed from `.htaccess` to handle Microsoft DAV clients\n        location = / {\n            if ( $http_user_agent ~ ^DavClnt ) {\n                return 302 /remote.php/webdav/$is_args$args;\n            }\n        }\n\n        location = /robots.txt {\n            allow all;\n            log_not_found off;\n            access_log off;\n        }\n\n        # Make a regex exception for `/.well-known` so that clients can still\n        # access it despite the existence of the regex rule\n        # `location ~ /(\\.|autotest|...)` which would otherwise handle requests\n        # for `/.well-known`.\n        location ^~ /.well-known {\n            # The rules in this block are an adaptation of the rules\n            # in `.htaccess` that concern `/.well-known`.\n\n            location = /.well-known/carddav { return 301 /remote.php/dav/; }\n            location = /.well-known/caldav  { return 301 /remote.php/dav/; }\n\n            location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }\n            location /.well-known/pki-validation    { try_files $uri $uri/ =404; }\n\n            # Let Nextcloud's API for `/.well-known` URIs handle all other\n            # requests by passing them to the front-end controller.\n            return 301 /index.php$request_uri;\n        }\n\n        # Rules borrowed from `.htaccess` to hide certain paths from clients\n        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }\n        location ~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)                { return 404; }\n\n        # Ensure this block, which passes PHP files to the PHP process, is above the blocks\n        # which handle static assets (as seen below). If this block is not declared first,\n        # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`\n        # to the URI, resulting in a HTTP 500 error response.\n        location ~ \\.php(?:$|/) {\n            # Required for legacy support\n            rewrite ^/(?!index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|.+\\/richdocumentscode(_arm64)?\\/proxy) /index.php$request_uri;\n\n            fastcgi_split_path_info ^(.+?\\.php)(/.*)$;\n            set $path_info $fastcgi_path_info;\n\n            try_files $fastcgi_script_name =404;\n\n            include fastcgi_params;\n            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n            fastcgi_param PATH_INFO $path_info;\n            fastcgi_param HTTPS on;\n\n            fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice\n            fastcgi_param front_controller_active true;     # Enable pretty urls\n            fastcgi_pass php-handler;\n\n            fastcgi_intercept_errors on;\n            fastcgi_request_buffering on;                   # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header.\n\n            fastcgi_max_temp_file_size 0;\n        }\n\n        # Serve static files\n        location ~ \\.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {\n            try_files $uri /index.php$request_uri;\n            add_header Cache-Control \"public, max-age=15778463$asset_immutable\";\n            add_header Referrer-Policy                   \"no-referrer\"       always;\n            add_header X-Content-Type-Options            \"nosniff\"           always;\n            add_header X-Frame-Options                   \"SAMEORIGIN\"        always;\n            add_header X-Permitted-Cross-Domain-Policies \"none\"              always;\n            add_header X-Robots-Tag                      \"noindex, nofollow\" always;\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        location ~ \\.(otf|woff2?)$ {\n            try_files $uri /index.php$request_uri;\n            expires 7d;         # Cache-Control policy borrowed from `.htaccess`\n            access_log off;     # Optional: Don't log access to assets\n        }\n\n        # Rule borrowed from `.htaccess`\n        location /remote {\n            return 301 /remote.php$request_uri;\n        }\n\n        location / {\n            try_files $uri $uri/ /index.php$request_uri;\n        }\n    }\n}\n"
  },
  {
    "path": ".examples/dockerfiles/cron/apache/Dockerfile",
    "content": "FROM nextcloud:apache\n\nRUN apt-get update && apt-get install -y \\\n    supervisor \\\n  && rm -rf /var/lib/apt/lists/* \\\n  && mkdir /var/log/supervisord /var/run/supervisord\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/cron/apache/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:apache2]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=apache2-foreground\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/cron/fpm/Dockerfile",
    "content": "FROM nextcloud:fpm\n\nRUN apt-get update && apt-get install -y \\\n    supervisor \\\n  && rm -rf /var/lib/apt/lists/* \\\n  && mkdir /var/log/supervisord /var/run/supervisord\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/cron/fpm/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:php-fpm]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=php-fpm\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/cron/fpm-alpine/Dockerfile",
    "content": "FROM nextcloud:fpm-alpine\n\nRUN apk add --no-cache supervisor \\\n  && mkdir /var/log/supervisord /var/run/supervisord\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/cron/fpm-alpine/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:php-fpm]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=php-fpm\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/full/apache/Dockerfile",
    "content": "FROM nextcloud:apache\n\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        ffmpeg \\\n        ghostscript \\\n        libmagickcore-6.q16-6-extra \\\n        procps \\\n        smbclient \\\n        supervisor \\\n#       libreoffice \\\n    ; \\\n    rm -rf /var/lib/apt/lists/*\n\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libbz2-dev \\\n        libc-client-dev \\\n        libkrb5-dev \\\n        libsmbclient-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install \\\n        bz2 \\\n        imap \\\n    ; \\\n    pecl install smbclient; \\\n    docker-php-ext-enable smbclient; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -r dpkg-query --search \\\n        | cut -d: -f1 \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    rm -rf /var/lib/apt/lists/*\n\nRUN mkdir -p \\\n    /var/log/supervisord \\\n    /var/run/supervisord \\\n;\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/full/apache/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:apache2]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=apache2-foreground\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/full/fpm/Dockerfile",
    "content": "FROM nextcloud:fpm\n\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        ffmpeg \\\n        ghostscript \\\n        libmagickcore-6.q16-6-extra \\\n        procps \\\n        smbclient \\\n        supervisor \\\n#       libreoffice \\\n    ; \\\n    rm -rf /var/lib/apt/lists/*\n\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libbz2-dev \\\n        libc-client-dev \\\n        libkrb5-dev \\\n        libsmbclient-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install \\\n        bz2 \\\n        imap \\\n    ; \\\n    pecl install smbclient; \\\n    docker-php-ext-enable smbclient; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -r dpkg-query --search \\\n        | cut -d: -f1 \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    rm -rf /var/lib/apt/lists/*\n\nRUN mkdir -p \\\n    /var/log/supervisord \\\n    /var/run/supervisord \\\n;\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/full/fpm/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:php-fpm]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=php-fpm\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/full/fpm-alpine/Dockerfile",
    "content": "FROM nextcloud:fpm-alpine\n\nRUN set -ex; \\\n    \\\n    apk add --no-cache \\\n        ffmpeg \\\n        imagemagick \\\n        procps \\\n        samba-client \\\n        supervisor \\\n#       libreoffice \\\n    ;\n\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        imap-dev \\\n        krb5-dev \\\n        openssl-dev \\\n        samba-dev \\\n        bzip2-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install \\\n        bz2 \\\n        imap \\\n    ; \\\n    pecl install smbclient; \\\n    docker-php-ext-enable smbclient; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del .build-deps\n\nRUN mkdir -p \\\n    /var/log/supervisord \\\n    /var/run/supervisord \\\n;\n\nCOPY supervisord.conf /\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\", \"-c\", \"/supervisord.conf\"]\n"
  },
  {
    "path": ".examples/dockerfiles/full/fpm-alpine/supervisord.conf",
    "content": "[supervisord]\nnodaemon=true\nlogfile=/var/log/supervisord/supervisord.log\npidfile=/var/run/supervisord/supervisord.pid\nchildlogdir=/var/log/supervisord/\nlogfile_maxbytes=50MB                           ; maximum size of logfile before rotation\nlogfile_backups=10                              ; number of backed up logfiles\nloglevel=error\n\n[program:php-fpm]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=php-fpm\n\n[program:cron]\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\ncommand=/cron.sh\n"
  },
  {
    "path": ".examples/dockerfiles/imap/apache/Dockerfile",
    "content": "FROM nextcloud:apache\n\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libc-client-dev \\\n        libkrb5-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install imap; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -r dpkg-query --search \\\n        | cut -d: -f1 \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": ".examples/dockerfiles/imap/fpm/Dockerfile",
    "content": "FROM nextcloud:fpm\n\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libc-client-dev \\\n        libkrb5-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install imap; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -r dpkg-query --search \\\n        | cut -d: -f1 \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": ".examples/dockerfiles/imap/fpm-alpine/Dockerfile",
    "content": "FROM nextcloud:fpm-alpine\n\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        imap-dev \\\n        krb5-dev \\\n        openssl-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \\\n    docker-php-ext-install imap; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del .build-deps\n"
  },
  {
    "path": ".examples/dockerfiles/smb/apache/Dockerfile",
    "content": "FROM nextcloud:apache\n\nRUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": ".examples/dockerfiles/smb/fpm/Dockerfile",
    "content": "FROM nextcloud:fpm\n\nRUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": ".examples/dockerfiles/smb/fpm-alpine/Dockerfile",
    "content": "FROM nextcloud:fpm-alpine\n\nRUN apk add --no-cache procps samba-client\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/01-Image_issue.md",
    "content": "---\nname: 🐛 Report a bug in the image\nabout: Create a report to help us improve the image\nlabels: \"bug, 0. Needs triage\"\n---\n\n<!--\nThanks for reporting issues back to Nextcloud!\n\nWhen reporting problems, please include your *complete* Docker Compose file (or run commands) and your Nextcloud Server config (e.g. `occ config:list system`). Incomplete reports cause extra work for all parties involved and delay resolution.\n\nNote: This is the issue tracker of the official Nextcloud **Docker image**, please do NOT use this to report issues with Docker or Nextcloud Server itself. You can find help debugging your system on our forums: https://help.nextcloud.com/ or https://forums.docker.com/.\n\nTo learn more about official images, see https://github.com/docker-library/faq\n-->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/02-Image_enhancement",
    "content": "---\nname: 🚀 Suggest an enhancement\nabout: Suggest an idea for improving the image\nlabels: \"enhancement, 0. Needs triage\"\n---\n\n<!--\nThanks for suggesting an idea to improve the Nextcloud Docker image!\n\nThis image is maintained by volunteers so if you're able to assist with implementing your idea, please mention that (and consider submitting a PR as well).\n\nNote: This is the issue tracker of the official Nextcloud **Docker image**, please do NOT use this to suggestion enhancements in Nextcloud Server itself. \n\nTo learn more about official images, see https://github.com/docker-library/faq\n-->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "contact_links:\n    - name: ❓ Ask a question\n      url: https://help.nextcloud.com/\n      about: Ask a question, get assistance or start a discussion regarding Nextcloud and/or this image\n    - name: Documentation - Nextcloud Server\n      url: https://docs.nextcloud.com/\n      about: Official documentation for Nextcloud Server\n    - name: Documentation - Nextcloud Docker Image\n      url: https://github.com/nextcloud/docker/blob/master/README.md\n      about: Official documentation for this image\n    - name: 🐳 Documentation - Docker\n      url: https://docs.docker.com/\n      about: Official documentation for Docker (installing, configuring, troubleshooting)  \n    - name: 🐳 Docker Forum\n      url: https://forums.docker.com/\n      about: Ask a question, get assistance or start a discussion regarding Docker\n    - name: 🐛 Bug Report - Nextcloud Server\n      url: https://github.com/nextcloud/server/issues/new/choose\n      about: Report a bug in Nextcloud Server\n    - name: Enhancement Idea - Nextcloud Server\n      url: https://github.com/nextcloud/server/issues/new/choose\n      about: Suggest an enhancement idea for Nextcloud Server\n"
  },
  {
    "path": ".github/workflows/images.yml",
    "content": "---\nname: Images\n\non:\n  pull_request:\n  workflow_run:\n    workflows: [\"update.sh\"]\n    branches: [master]\n    types:\n      - completed\n\ndefaults:\n  run:\n    shell: 'bash -Eeuo pipefail -x {0}'\n\njobs:\n\n  init:\n    name: Generate Jobs\n    runs-on: ubuntu-latest\n    outputs:\n      strategy: ${{ steps.generate-jobs.outputs.strategy }}\n    steps:\n      - uses: actions/checkout@v4\n      - uses: docker-library/bashbrew@HEAD\n      - id: generate-jobs\n        name: Generate Jobs\n        run: |\n          strategy=\"$(GITHUB_REPOSITORY=nextcloud \"$BASHBREW_SCRIPTS/github-actions/generate.sh\")\"\n          strategy=\"$(\"$BASHBREW_SCRIPTS/github-actions/munge-i386.sh\" -c <<<\"$strategy\")\"\n          echo \"strategy=$strategy\" >> \"$GITHUB_OUTPUT\"\n          jq . <<<\"$strategy\" # sanity check / debugging aid\n\n  test:\n    needs: init\n    strategy: ${{ fromJson(needs.init.outputs.strategy) }}\n    name: ${{ matrix.name }}\n    runs-on: ${{ matrix.os }}\n    steps:\n      - uses: actions/checkout@v4\n      - name: Prepare Environment\n        run: ${{ matrix.runs.prepare }}\n      - name: Run update.sh script\n        run: ./update.sh\n      - name: Pull Dependencies\n        run: ${{ matrix.runs.pull }}\n      - name: Build ${{ matrix.name }}\n        run: ${{ matrix.runs.build }}\n      - name: History ${{ matrix.name }}\n        run: ${{ matrix.runs.history }}\n      - name: Test ${{ matrix.name }}\n        run: ${{ matrix.runs.test }}\n      - name: '\"docker images\"'\n        run: ${{ matrix.runs.images }}\n\n  summary:\n    runs-on: ubuntu-latest\n    needs: test\n\n    if: always()\n\n    name: images-test-summary\n\n    steps:\n      - name: Summary status\n        run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi\n"
  },
  {
    "path": ".github/workflows/update-sh.yml",
    "content": "---\nname: update.sh\n\non:\n  push:\n    branches:\n      - master\n  schedule:\n    - cron: '15 18 * * *'\n  workflow_dispatch:\n\njobs:\n  run_update_sh:\n    name: Run update.sh script\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run update.sh script\n        run: ./update.sh\n      - name: Commit files\n        run: |\n          git config --local user.email \"workflow@github.com\"\n          git config --local user.name \"GitHub Workflow\"\n          git add -A\n          git commit -m \"Runs update.sh\" || echo \"Nothing to update\"\n      - name: Push changes\n        uses: ad-m/github-push-action@master\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          force: true\n"
  },
  {
    "path": "31/apache/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.3-apache-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\nRUN a2enmod headers rewrite remoteip ; \\\n    { \\\n     echo 'RemoteIPHeader X-Real-IP'; \\\n     echo 'RemoteIPInternalProxy 10.0.0.0/8'; \\\n     echo 'RemoteIPInternalProxy 172.16.0.0/12'; \\\n     echo 'RemoteIPInternalProxy 192.168.0.0/16'; \\\n    } > /etc/apache2/conf-available/remoteip.conf; \\\n    a2enconf remoteip\n\n# set apache config LimitRequestBody\nENV APACHE_BODY_LIMIT 1073741824\nRUN { \\\n     echo 'LimitRequestBody ${APACHE_BODY_LIMIT}'; \\\n    } > /etc/apache2/conf-available/apache-limits.conf; \\\n    a2enconf apache-limits\n\nENV NEXTCLOUD_VERSION 31.0.14\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"apache2-foreground\"]\n"
  },
  {
    "path": "31/apache/config/apache-pretty-urls.config.php",
    "content": "<?php\n$CONFIG = array (\n  'htaccess.RewriteBase' => '/',\n);\n"
  },
  {
    "path": "31/apache/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "31/apache/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "31/apache/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "31/apache/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "31/apache/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "31/apache/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "31/apache/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "31/apache/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "31/apache/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "31/apache/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "31/apache/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "31/apache/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "31/fpm/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.3-fpm-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 31.0.14\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "31/fpm/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "31/fpm/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "31/fpm/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "31/fpm/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "31/fpm/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "31/fpm/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "31/fpm/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "31/fpm/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "31/fpm/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "31/fpm/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "31/fpm/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "31/fpm/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "31/fpm-alpine/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template\nFROM php:8.3-fpm-alpine3.23\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apk add --no-cache \\\n        imagemagick \\\n        imagemagick-pdf \\\n        imagemagick-jpeg \\\n        imagemagick-raw \\\n        imagemagick-tiff \\\n        imagemagick-heic \\\n        imagemagick-webp \\\n        imagemagick-svg \\\n        rsync \\\n    ; \\\n    \\\n    rm /var/spool/cron/crontabs/root; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        autoconf \\\n        freetype-dev \\\n        gmp-dev \\\n        icu-dev \\\n        imagemagick-dev \\\n        libevent-dev \\\n        libjpeg-turbo-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n        openldap-dev \\\n        pcre-dev \\\n        postgresql-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --no-network --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del --no-network .build-deps\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 31.0.14\n\nRUN set -ex; \\\n    apk add --no-cache --virtual .fetch-deps \\\n        bzip2 \\\n        gnupg \\\n    ; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com  --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    apk del --no-network .fetch-deps\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "31/fpm-alpine/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "31/fpm-alpine/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "31/fpm-alpine/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "31/fpm-alpine/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "31/fpm-alpine/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "31/fpm-alpine/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "31/fpm-alpine/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "32/apache/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.3-apache-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\nRUN a2enmod headers rewrite remoteip ; \\\n    { \\\n     echo 'RemoteIPHeader X-Real-IP'; \\\n     echo 'RemoteIPInternalProxy 10.0.0.0/8'; \\\n     echo 'RemoteIPInternalProxy 172.16.0.0/12'; \\\n     echo 'RemoteIPInternalProxy 192.168.0.0/16'; \\\n    } > /etc/apache2/conf-available/remoteip.conf; \\\n    a2enconf remoteip\n\n# set apache config LimitRequestBody\nENV APACHE_BODY_LIMIT 1073741824\nRUN { \\\n     echo 'LimitRequestBody ${APACHE_BODY_LIMIT}'; \\\n    } > /etc/apache2/conf-available/apache-limits.conf; \\\n    a2enconf apache-limits\n\nENV NEXTCLOUD_VERSION 32.0.6\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"apache2-foreground\"]\n"
  },
  {
    "path": "32/apache/config/apache-pretty-urls.config.php",
    "content": "<?php\n$CONFIG = array (\n  'htaccess.RewriteBase' => '/',\n);\n"
  },
  {
    "path": "32/apache/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "32/apache/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "32/apache/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "32/apache/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "32/apache/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "32/apache/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "32/apache/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "32/apache/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "32/apache/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "32/apache/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "32/apache/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "32/apache/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "32/fpm/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.3-fpm-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 32.0.6\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "32/fpm/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "32/fpm/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "32/fpm/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "32/fpm/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "32/fpm/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "32/fpm/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "32/fpm/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "32/fpm/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "32/fpm/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "32/fpm/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "32/fpm/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "32/fpm/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "32/fpm-alpine/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template\nFROM php:8.3-fpm-alpine3.23\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apk add --no-cache \\\n        imagemagick \\\n        imagemagick-pdf \\\n        imagemagick-jpeg \\\n        imagemagick-raw \\\n        imagemagick-tiff \\\n        imagemagick-heic \\\n        imagemagick-webp \\\n        imagemagick-svg \\\n        rsync \\\n    ; \\\n    \\\n    rm /var/spool/cron/crontabs/root; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        autoconf \\\n        freetype-dev \\\n        gmp-dev \\\n        icu-dev \\\n        imagemagick-dev \\\n        libevent-dev \\\n        libjpeg-turbo-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n        openldap-dev \\\n        pcre-dev \\\n        postgresql-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure ftp --with-openssl-dir=/usr; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --no-network --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del --no-network .build-deps\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 32.0.6\n\nRUN set -ex; \\\n    apk add --no-cache --virtual .fetch-deps \\\n        bzip2 \\\n        gnupg \\\n    ; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com  --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    apk del --no-network .fetch-deps\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "32/fpm-alpine/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "32/fpm-alpine/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "32/fpm-alpine/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "32/fpm-alpine/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "32/fpm-alpine/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "32/fpm-alpine/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "32/fpm-alpine/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "33/apache/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.4-apache-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-ftp-ssl; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\nRUN a2enmod headers rewrite remoteip ; \\\n    { \\\n     echo 'RemoteIPHeader X-Real-IP'; \\\n     echo 'RemoteIPInternalProxy 10.0.0.0/8'; \\\n     echo 'RemoteIPInternalProxy 172.16.0.0/12'; \\\n     echo 'RemoteIPInternalProxy 192.168.0.0/16'; \\\n    } > /etc/apache2/conf-available/remoteip.conf; \\\n    a2enconf remoteip\n\n# set apache config LimitRequestBody\nENV APACHE_BODY_LIMIT 1073741824\nRUN { \\\n     echo 'LimitRequestBody ${APACHE_BODY_LIMIT}'; \\\n    } > /etc/apache2/conf-available/apache-limits.conf; \\\n    a2enconf apache-limits\n\nENV NEXTCLOUD_VERSION 33.0.0\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"apache2-foreground\"]\n"
  },
  {
    "path": "33/apache/config/apache-pretty-urls.config.php",
    "content": "<?php\n$CONFIG = array (\n  'htaccess.RewriteBase' => '/',\n);\n"
  },
  {
    "path": "33/apache/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "33/apache/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "33/apache/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "33/apache/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "33/apache/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "33/apache/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "33/apache/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "33/apache/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "33/apache/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "33/apache/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "33/apache/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "33/apache/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "33/fpm/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-debian.template\nFROM php:8.4-fpm-trixie\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp --with-ftp-ssl; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 33.0.0\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "33/fpm/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "33/fpm/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "33/fpm/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "33/fpm/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "33/fpm/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "33/fpm/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "33/fpm/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "33/fpm/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "33/fpm/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "33/fpm/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "33/fpm/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "33/fpm/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "33/fpm-alpine/Dockerfile",
    "content": "# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template\nFROM php:8.4-fpm-alpine3.23\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apk add --no-cache \\\n        imagemagick \\\n        imagemagick-pdf \\\n        imagemagick-jpeg \\\n        imagemagick-raw \\\n        imagemagick-tiff \\\n        imagemagick-heic \\\n        imagemagick-webp \\\n        imagemagick-svg \\\n        rsync \\\n    ; \\\n    \\\n    rm /var/spool/cron/crontabs/root; \\\n    echo '*/5 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        autoconf \\\n        freetype-dev \\\n        gmp-dev \\\n        icu-dev \\\n        imagemagick-dev \\\n        libevent-dev \\\n        libjpeg-turbo-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n        openldap-dev \\\n        pcre-dev \\\n        postgresql-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure ftp --with-ftp-ssl; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-5.1.28; \\\n    pecl install igbinary-3.2.16; \\\n    pecl install imagick-3.8.1; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-3.4.0; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-6.3.0; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --no-network --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del --no-network .build-deps\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n\n\nENV NEXTCLOUD_VERSION 33.0.0\n\nRUN set -ex; \\\n    apk add --no-cache --virtual .fetch-deps \\\n        bzip2 \\\n        gnupg \\\n    ; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2.asc\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com  --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    apk del --no-network .fetch-deps\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"php-fpm\"]\n"
  },
  {
    "path": "33/fpm-alpine/config/apcu.config.php",
    "content": "<?php\n$CONFIG = array (\n  'memcache.local' => '\\OC\\Memcache\\APCu',\n);\n"
  },
  {
    "path": "33/fpm-alpine/config/apps.config.php",
    "content": "<?php\n$CONFIG = array (\n  'apps_paths' => array (\n      0 => array (\n              'path'     => OC::$SERVERROOT.'/apps',\n              'url'      => '/apps',\n              'writable' => false,\n      ),\n      1 => array (\n              'path'     => OC::$SERVERROOT.'/custom_apps',\n              'url'      => '/custom_apps',\n              'writable' => true,\n      ),\n  ),\n);\n"
  },
  {
    "path": "33/fpm-alpine/config/autoconfig.php",
    "content": "<?php\n\n$autoconfig_enabled = false;\n\nif (getenv('SQLITE_DATABASE')) {\n    $AUTOCONFIG['dbtype'] = 'sqlite';\n    $AUTOCONFIG['dbname'] = getenv('SQLITE_DATABASE');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE_FILE') && getenv('MYSQL_USER_FILE') && getenv('MYSQL_PASSWORD_FILE') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('MYSQL_DATABASE_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('MYSQL_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('MYSQL_DATABASE') && getenv('MYSQL_USER') && getenv('MYSQL_PASSWORD') && getenv('MYSQL_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'mysql';\n    $AUTOCONFIG['dbname'] = getenv('MYSQL_DATABASE');\n    $AUTOCONFIG['dbuser'] = getenv('MYSQL_USER');\n    $AUTOCONFIG['dbpass'] = getenv('MYSQL_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('MYSQL_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB_FILE') && getenv('POSTGRES_USER_FILE') && getenv('POSTGRES_PASSWORD_FILE') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = trim(file_get_contents(getenv('POSTGRES_DB_FILE')));\n    $AUTOCONFIG['dbuser'] = trim(file_get_contents(getenv('POSTGRES_USER_FILE')));\n    $AUTOCONFIG['dbpass'] = trim(file_get_contents(getenv('POSTGRES_PASSWORD_FILE')));\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n} elseif (getenv('POSTGRES_DB') && getenv('POSTGRES_USER') && getenv('POSTGRES_PASSWORD') && getenv('POSTGRES_HOST')) {\n    $AUTOCONFIG['dbtype'] = 'pgsql';\n    $AUTOCONFIG['dbname'] = getenv('POSTGRES_DB');\n    $AUTOCONFIG['dbuser'] = getenv('POSTGRES_USER');\n    $AUTOCONFIG['dbpass'] = getenv('POSTGRES_PASSWORD');\n    $AUTOCONFIG['dbhost'] = getenv('POSTGRES_HOST');\n    $autoconfig_enabled = true;\n}\n\nif ($autoconfig_enabled) {\n    $AUTOCONFIG['directory'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/html/data';\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/redis.config.php",
    "content": "<?php\nif (getenv('REDIS_HOST')) {\n  $CONFIG = array(\n    'memcache.distributed' => '\\OC\\Memcache\\Redis',\n    'memcache.locking' => '\\OC\\Memcache\\Redis',\n    'redis' => array(\n      'host' => getenv('REDIS_HOST'),\n      'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'),\n    ),\n  );\n\n  if (getenv('REDIS_HOST_PORT') !== false) {\n    $CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');\n  } elseif (getenv('REDIS_HOST')[0] != '/') {\n    $CONFIG['redis']['port'] = 6379;\n  }\n\n  if (getenv('REDIS_HOST_USER') !== false) {\n    $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');\n  }\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/reverse-proxy.config.php",
    "content": "<?php\n$overwriteHost = getenv('OVERWRITEHOST');\nif ($overwriteHost) {\n  $CONFIG['overwritehost'] = $overwriteHost;\n}\n\n$overwriteProtocol = getenv('OVERWRITEPROTOCOL');\nif ($overwriteProtocol) {\n  $CONFIG['overwriteprotocol'] = $overwriteProtocol;\n}\n\n$overwriteCliUrl = getenv('OVERWRITECLIURL');\nif ($overwriteCliUrl) {\n  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;\n}\n\n$overwriteWebRoot = getenv('OVERWRITEWEBROOT');\nif ($overwriteWebRoot) {\n  $CONFIG['overwritewebroot'] = $overwriteWebRoot;\n}\n\n$overwriteCondAddr = getenv('OVERWRITECONDADDR');\nif ($overwriteCondAddr) {\n  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;\n}\n\n$trustedProxies = getenv('TRUSTED_PROXIES');\nif ($trustedProxies) {\n  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));\n}\n\n$forwardedForHeaders = getenv('FORWARDED_FOR_HEADERS');\nif ($forwardedForHeaders) {\n  $CONFIG['forwarded_for_headers'] = array_filter(array_map('trim', explode(' ', $forwardedForHeaders)));\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/s3.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_S3_BUCKET')) {\n  $use_ssl = getenv('OBJECTSTORE_S3_SSL');\n  $use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');\n  $use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');\n  $autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => array(\n      'class' => '\\OC\\Files\\ObjectStore\\S3',\n      'arguments' => array(\n        'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),\n        'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',\n        'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',\n        'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',\n        'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',\n        'objectPrefix' => getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") ? getenv(\"OBJECTSTORE_S3_OBJECT_PREFIX\") : \"urn:oid:\",\n        'autocreate' => strtolower($autocreate) !== 'false',\n        'use_ssl' => strtolower($use_ssl) !== 'false',\n        // required for some non Amazon S3 implementations\n        'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',\n        // required for older protocol versions\n        'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false'\n      )\n    )\n  );\n\n  if (getenv('OBJECTSTORE_S3_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_KEY')) {\n    $CONFIG['objectstore']['arguments']['key'] = getenv('OBJECTSTORE_S3_KEY');\n  } else {\n    $CONFIG['objectstore']['arguments']['key'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SECRET_FILE')) {\n    $CONFIG['objectstore']['arguments']['secret'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SECRET_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SECRET')) {\n    $CONFIG['objectstore']['arguments']['secret'] = getenv('OBJECTSTORE_S3_SECRET');\n  } else {\n    $CONFIG['objectstore']['arguments']['secret'] = '';\n  }\n\n  if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE')));\n  } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) {\n    $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY');\n  }\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/smtp.config.php",
    "content": "<?php\nif (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {\n  $CONFIG = array (\n    'mail_smtpmode' => 'smtp',\n    'mail_smtphost' => getenv('SMTP_HOST'),\n    'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25),\n    'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '',\n    'mail_smtpauth' => getenv('SMTP_NAME') && (getenv('SMTP_PASSWORD') || getenv('SMTP_PASSWORD_FILE')),\n    'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN',\n    'mail_smtpname' => getenv('SMTP_NAME') ?: '',\n    'mail_from_address' => getenv('MAIL_FROM_ADDRESS'),\n    'mail_domain' => getenv('MAIL_DOMAIN'),\n  );\n\n  if (getenv('SMTP_PASSWORD_FILE')) {\n      $CONFIG['mail_smtppassword'] = trim(file_get_contents(getenv('SMTP_PASSWORD_FILE')));\n  } elseif (getenv('SMTP_PASSWORD')) {\n      $CONFIG['mail_smtppassword'] = getenv('SMTP_PASSWORD');\n  } else {\n      $CONFIG['mail_smtppassword'] = '';\n  }\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/swift.config.php",
    "content": "<?php\nif (getenv('OBJECTSTORE_SWIFT_URL')) {\n    $autocreate = getenv('OBJECTSTORE_SWIFT_AUTOCREATE');\n  $CONFIG = array(\n    'objectstore' => [\n      'class' => 'OC\\\\Files\\\\ObjectStore\\\\Swift',\n      'arguments' => [\n        'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false',\n        'user' => [\n          'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'),\n          'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'),\n          'domain' => [\n            'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default',\n          ],\n        ],\n        'scope' => [\n          'project' => [\n            'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'),\n            'domain' => [\n              'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default',\n            ],\n          ],\n        ],\n        'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift',\n        'region' => getenv('OBJECTSTORE_SWIFT_REGION'),\n        'url' => getenv('OBJECTSTORE_SWIFT_URL'),\n        'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'),\n      ]\n    ]\n  );\n}\n"
  },
  {
    "path": "33/fpm-alpine/config/upgrade-disable-web.config.php",
    "content": "<?php\n$CONFIG = array (\n  'upgrade.disable-web' => true,\n);\n"
  },
  {
    "path": "33/fpm-alpine/cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "33/fpm-alpine/entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "33/fpm-alpine/upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "In the Nextcloud community, participants from all over the world come together to create Free Software for a free internet. This is made possible by the support, hard work and enthusiasm of thousands of people, including those who create and use Nextcloud software.\n\nOur code of conduct offers some guidance to ensure Nextcloud participants can cooperate effectively in a positive and inspiring atmosphere, and to explain how together we can strengthen and support each other.\n\nThe Code of Conduct is shared by all contributors and users who engage with the Nextcloud team and its community services. It presents a summary of the shared values and “common sense” thinking in our community.\n\nYou can find our full code of conduct on our website: https://nextcloud.com/code-of-conduct/\n\nPlease, keep our CoC in mind when you contribute! That way, everyone can be a part of our community in a productive, positive, creative and fun way.\n"
  },
  {
    "path": "Dockerfile-alpine.template",
    "content": "FROM php:%%PHP_VERSION%%-%%VARIANT%%%%ALPINE_VERSION%%\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apk add --no-cache \\\n        imagemagick \\\n        imagemagick-pdf \\\n        imagemagick-jpeg \\\n        imagemagick-raw \\\n        imagemagick-tiff \\\n        imagemagick-heic \\\n        imagemagick-webp \\\n        imagemagick-svg \\\n        rsync \\\n    ; \\\n    \\\n    rm /var/spool/cron/crontabs/root; \\\n    echo '*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nRUN set -ex; \\\n    \\\n    apk add --no-cache --virtual .build-deps \\\n        $PHPIZE_DEPS \\\n        autoconf \\\n        freetype-dev \\\n        gmp-dev \\\n        icu-dev \\\n        imagemagick-dev \\\n        libevent-dev \\\n        libjpeg-turbo-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n        openldap-dev \\\n        pcre-dev \\\n        postgresql-dev \\\n    ; \\\n    \\\n    docker-php-ext-configure ftp %%FTP_OPTIONS%%; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-%%APCU_VERSION%%; \\\n    pecl install igbinary-%%IGBINARY_VERSION%%; \\\n    pecl install imagick-%%IMAGICK_VERSION%%; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-%%MEMCACHED_VERSION%%; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-%%REDIS_VERSION%%; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n    runDeps=\"$( \\\n        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \\\n            | tr ',' '\\n' \\\n            | sort -u \\\n            | awk 'system(\"[ -e /usr/local/lib/\" $1 \" ]\") == 0 { next } { print \"so:\" $1 }' \\\n    )\"; \\\n    apk add --no-network --virtual .nextcloud-phpext-rundeps $runDeps; \\\n    apk del --no-network .build-deps\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n%%VARIANT_EXTRAS%%\n\nENV NEXTCLOUD_VERSION %%VERSION%%\n\nRUN set -ex; \\\n    apk add --no-cache --virtual .fetch-deps \\\n        bzip2 \\\n        gnupg \\\n    ; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"%%DOWNLOAD_URL%%\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"%%DOWNLOAD_URL_ASC%%\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com  --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    apk del --no-network .fetch-deps\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"%%CMD%%\"]\n"
  },
  {
    "path": "Dockerfile-debian.template",
    "content": "FROM php:%%PHP_VERSION%%-%%VARIANT%%-%%DEBIAN_VERSION%%\n\n# entrypoint.sh and cron.sh dependencies\nRUN set -ex; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        busybox-static \\\n        bzip2 \\\n        libldap-common \\\n        libmagickcore-7.q16-10-extra \\\n        rsync \\\n    ; \\\n    apt-get dist-clean; \\\n    \\\n    mkdir -p /var/spool/cron/crontabs; \\\n    echo '*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data\n\n# install the PHP extensions we need\n# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html\nENV PHP_MEMORY_LIMIT 512M\nENV PHP_UPLOAD_LIMIT 512M\nENV PHP_OPCACHE_MEMORY_CONSUMPTION 128\nRUN set -ex; \\\n    \\\n    savedAptMark=\"$(apt-mark showmanual)\"; \\\n    \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends \\\n        libcurl4-openssl-dev \\\n        libevent-dev \\\n        libfreetype6-dev \\\n        libgmp-dev \\\n        libicu-dev \\\n        libjpeg-dev \\\n        libldap2-dev \\\n        liblz4-dev \\\n        libmagickwand-dev \\\n        libmemcached-dev \\\n        libpng-dev \\\n        libpq-dev \\\n        libwebp-dev \\\n        libxml2-dev \\\n        libzip-dev \\\n    ; \\\n    \\\n    debMultiarch=\"$(dpkg-architecture --query DEB_BUILD_MULTIARCH)\"; \\\n    docker-php-ext-configure ftp %%FTP_OPTIONS%%; \\\n    docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \\\n    docker-php-ext-configure ldap --with-libdir=\"lib/$debMultiarch\"; \\\n    docker-php-ext-install -j \"$(nproc)\" \\\n        bcmath \\\n        exif \\\n        ftp \\\n        gd \\\n        gmp \\\n        intl \\\n        ldap \\\n        pcntl \\\n        pdo_mysql \\\n        pdo_pgsql \\\n        sysvsem \\\n        zip \\\n    ; \\\n    \\\n# pecl will claim success even if one install fails, so we need to perform each install separately\n    pecl install APCu-%%APCU_VERSION%%; \\\n    pecl install igbinary-%%IGBINARY_VERSION%%; \\\n    pecl install imagick-%%IMAGICK_VERSION%%; \\\n    pecl install --configureoptions 'enable-memcached-igbinary=\"yes\"' \\\n        memcached-%%MEMCACHED_VERSION%%; \\\n    pecl install --configureoptions 'enable-redis-igbinary=\"yes\" enable-redis-zstd=\"yes\" enable-redis-lz4=\"yes\"' \\\n        redis-%%REDIS_VERSION%%; \\\n    \\\n    docker-php-ext-enable \\\n        apcu \\\n        igbinary \\\n        imagick \\\n        memcached \\\n        redis \\\n    ; \\\n    rm -r /tmp/pear; \\\n    \\\n# reset apt-mark's \"manual\" list so that \"purge --auto-remove\" will remove all build dependencies\n    apt-mark auto '.*' > /dev/null; \\\n    apt-mark manual $savedAptMark; \\\n    ldd \"$(php -r 'echo ini_get(\"extension_dir\");')\"/*.so \\\n        | awk '/=>/ { so = $(NF-1); if (index(so, \"/usr/local/\") == 1) { next }; gsub(\"^/(usr/)?\", \"\", so); print so }' \\\n        | sort -u \\\n        | xargs -rt dpkg-query --search \\\n# https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file)\n        | awk 'sub(\":$\", \"\", $1) { print $1 }' \\\n        | sort -u \\\n        | xargs -rt apt-mark manual; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\\n    apt-get dist-clean\n\n# set recommended PHP.ini settings\n# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache\nRUN { \\\n        echo 'opcache.enable=1'; \\\n        echo 'opcache.interned_strings_buffer=32'; \\\n        echo 'opcache.max_accelerated_files=10000'; \\\n        echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \\\n        echo 'opcache.save_comments=1'; \\\n        echo 'opcache.revalidate_freq=60'; \\\n        echo 'opcache.jit=1255'; \\\n        echo 'opcache.jit_buffer_size=8M'; \\\n    } > \"${PHP_INI_DIR}/conf.d/opcache-recommended.ini\"; \\\n    \\\n    echo 'apc.enable_cli=1' >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini\"; \\\n    \\\n    { \\\n        echo 'apc.serializer=igbinary'; \\\n        echo 'session.serialize_handler=igbinary'; \\\n    } >> \"${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini\"; \\\n    \\\n    { \\\n        echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \\\n        echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \\\n        echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \\\n    } > \"${PHP_INI_DIR}/conf.d/nextcloud.ini\"; \\\n    \\\n    mkdir /var/www/data; \\\n    mkdir -p /docker-entrypoint-hooks.d/pre-installation \\\n             /docker-entrypoint-hooks.d/post-installation \\\n             /docker-entrypoint-hooks.d/pre-upgrade \\\n             /docker-entrypoint-hooks.d/post-upgrade \\\n             /docker-entrypoint-hooks.d/before-starting; \\\n    chown -R www-data:root /var/www; \\\n    chmod -R g=u /var/www\n\nVOLUME /var/www/html\n%%VARIANT_EXTRAS%%\n\nENV NEXTCLOUD_VERSION %%VERSION%%\n\nRUN set -ex; \\\n    fetchDeps=\" \\\n        gnupg \\\n        dirmngr \\\n    \"; \\\n    apt-get update; \\\n    apt-get install -y --no-install-recommends $fetchDeps; \\\n    \\\n    curl -fsSL -o nextcloud.tar.bz2 \"%%DOWNLOAD_URL%%\"; \\\n    curl -fsSL -o nextcloud.tar.bz2.asc \"%%DOWNLOAD_URL_ASC%%\"; \\\n    export GNUPGHOME=\"$(mktemp -d)\"; \\\n# gpg key from https://nextcloud.com/nextcloud.asc\n    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \\\n    gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    tar -xjf nextcloud.tar.bz2 -C /usr/src/; \\\n    gpgconf --kill all; \\\n    rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \\\n    rm -rf \"$GNUPGHOME\" /usr/src/nextcloud/updater; \\\n    mkdir -p /usr/src/nextcloud/data; \\\n    mkdir -p /usr/src/nextcloud/custom_apps; \\\n    chmod +x /usr/src/nextcloud/occ; \\\n    \\\n    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \\\n    apt-get dist-clean\n\nCOPY *.sh upgrade.exclude /\nCOPY config/* /usr/src/nextcloud/config/\n\nENTRYPOINT [\"/entrypoint.sh\"]\nCMD [\"%%CMD%%\"]\n"
  },
  {
    "path": "LICENSE.md",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<http://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "![GitHub last commit](https://img.shields.io/github/last-commit/nextcloud/docker)\n[![GitHub Release](https://img.shields.io/github/v/release/nextcloud/docker?link=https%3A%2F%2Fgithub.com%2Fnextcloud%2Fdocker%2Freleases%2Flatest&label=latest%20Image)](https://github.com/nextcloud/docker/releases/)\n[![Docker Image Version](https://img.shields.io/docker/v/library/nextcloud?sort=semver&logo=nextcloud&label=Nextcloud)](https://nextcloud.com/changelog/)\n![GitHub commits since latest release](https://img.shields.io/github/commits-since/nextcloud/docker/latest)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/nextcloud/docker)\n![GitHub contributors](https://img.shields.io/github/contributors/nextcloud/docker?label=contributors%20-%20Thank%20you!)\n![Docker Pulls](https://img.shields.io/docker/pulls/library/nextcloud)\n[![Helm](https://img.shields.io/badge/Helm-0F1689?logo=helm&logoColor=fff)](https://github.com/nextcloud/helm/?tab=readme-ov-file)\n\n# What is Nextcloud?\n\nA safe home for all your data. Access & share your files, calendars, contacts, mail & more from any device, on your terms.\n\n![logo](https://cdn.rawgit.com/nextcloud/docker/071b888f7f689caa62c1498b6c61cb3599bcea2b/logo.svg)\n\n⚠️⚠️⚠️ This image is maintained by community volunteers and designed for expert use. For quick and easy deployment that supports the full set of Nextcloud Hub features, use the [Nextcloud All-in-One docker container](https://github.com/nextcloud/all-in-one#nextcloud-all-in-one) maintained by Nextcloud GmbH.\n\n## Table of Contents\n- [What is Nextcloud?](#what-is-nextcloud)\n- [How to use this image](#how-to-use-this-image)\n  - [Getting help](#getting-help)\n  - [Using the apache image](#using-the-apache-image)\n  - [Using the fpm image](#using-the-fpm-image)\n  - [Using an external database](#using-an-external-database)\n  - [Persistent data](#persistent-data)\n    - [Additional volumes](#additional-volumes)\n    - [Custom volumes](#custom-volumes)\n  - [Running as an arbitrary user / file permissions / changing the default container user](#running-as-an-arbitrary-user--file-permissions--changing-the-default-container-user)\n  - [Accessing the Nextcloud command-line interface (`occ`)](#accessing-the-nextcloud-command-line-interface-occ)\n  - [Viewing the Nextcloud configuration (`config.php`)](#viewing-the-nextcloud-configuration-configphp)\n  - [Auto configuration via environment variables](#auto-configuration-via-environment-variables)\n    - [Database parameters](#database-parameters)\n    - [Initial admin account](#initial-admin-account)\n    - [Custom Data directory (`datadirectory`)](#custom-data-directory-datadirectory)\n    - [Trusted domains (`trusted_domains`)](#trusted-domains-trusted_domains)\n    - [Image specific](#image-specific)\n    - [Redis Memory Caching](#redis-memory-caching)\n    - [E-mail (SMTP) Configuration](#e-mail-smtp-configuration)\n    - [Object Storage (Primary Storage)](#object-storage-primary-storage)\n    - [PHP Configuration](#php-configuration)\n    - [Apache Configuration](#apache-configuration)\n    - [Using the image behind a reverse proxy and specifying the server host and protocol](#using-the-image-behind-a-reverse-proxy-and-specifying-the-server-host-and-protocol)\n    - [Handling `Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile` (aka: Auto configuration and Nextcloud updates)](#handling-warning-varwwwhtmlconfigcfgfile-differs-from-the-latest-version-of-this-image-at-usrsrcnextcloudconfigcfgfile-aka-auto-configuration-and-nextcloud-updates)\n  - [Auto configuration via hook folders](#auto-configuration-via-hook-folders)\n- [Running this image with `docker compose`](#running-this-image-with-docker-compose)\n  - [Base version - apache](#base-version---apache)\n  - [Base version - FPM](#base-version---fpm)\n- [Docker Secrets](#docker-secrets)\n- [Make your Nextcloud available from the internet](#make-your-nextcloud-available-from-the-internet)\n  - [HTTPS - SSL encryption](#https---ssl-encryption)\n- [First use](#first-use)\n- [Update to a newer version](#update-to-a-newer-version)\n- [Adding Features](#adding-features)\n- [Migrating an existing installation](#migrating-an-existing-installation)\n  - [Migrating from a non-Alpine image to an Alpine image](#migrating-from-a-non-alpine-image-to-an-alpine-image)\n- [Reporting bugs or suggesting enhancements](#reporting-bugs-or-suggesting-enhancements)\n\n# How to use this image\nThis image is designed to be used in a micro-service environment. There are two versions of the image you can choose from.\n\nThe `apache` tag contains a full Nextcloud installation including an apache web server. It is designed to be easy to use and gets you running pretty fast. This is also the default for the `latest` tag and version tags that are not further specified.\n\nThe second option is a `fpm` container. It is based on the [php-fpm](https://hub.docker.com/_/php/) image and runs a fastCGI-Process that serves your Nextcloud page. To use this image it must be combined with any webserver that can proxy the http requests to the FastCGI-port of the container.\n\n[![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/nextcloud/docker/8db861d67f257a3e9ac1790ea06d4e2a7a193a6c/stack.yml)\n\n## Getting help\n\nMost Nextcloud Server administrative matters are covered in the official [Nextcloud Admin Manual](https://docs.nextcloud.com/server/latest/admin_manual/) or [other official Nextcloud documentation](https://docs.nextcloud.com) (which are all routinely updated).\n\n[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)\n[![Discourse Posts](https://img.shields.io/discourse/posts?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)\n\n**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as \"bugs\" (unless they are bugs of course). This helps the \nmaintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests \non the [community help forum](https://help.nextcloud.com/).)\n\nFor the image specifically, we provide [some simple deployment examples](https://github.com/nextcloud/docker/?tab=readme-ov-file#running-this-image-with-docker-compose) as well as some more extensive [deployment examples](https://github.com/nextcloud/docker/tree/master/.examples). In addition, the [community help forum](https://help.nextcloud.com/) has a \"how-to\" section with further examples of other peoples' container based Nextcloud stacks.\n\nBelow you'll find the main documentation for using this image.\n\n## Using the apache image\nThe apache image contains a webserver and exposes port 80. To start the container type:\n\n```console\n$ docker run -d -p 8080:80 nextcloud\n```\n\nNow you can access Nextcloud at http://localhost:8080/ from your host system.\n\nWARNING: This example is only suitable for limited testing purposes. Please read on to understand how the image handles storing your data and other aspects you need to consider to establish a full Nextcloud stack.\n\n\n## Using the fpm image\nTo use the fpm image, you need an additional web server, such as [nginx](https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html), that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. In most cases, you might want to use another container or your host as proxy. If you use your host you can address your Nextcloud container directly on port 9000. If you use another container, make sure that you add them to the same docker network (via `docker run --network <NAME> ...` or a `docker compose` file). In both cases you don't want to map the fpm port to your host.\n\n```console\n$ docker run -d nextcloud:fpm\n```\n\nAs the fastCGI-Process is not capable of serving static files (style sheets, images, ...), the webserver needs access to these files. This can be achieved with the `volumes-from` option. You can find more information in the [docker compose section](#running-this-image-with-docker-compose).\n\n## Using an external database\nBy default, this container uses SQLite for data storage but the Nextcloud setup wizard (appears on first run) allows connecting to an existing MySQL/MariaDB or PostgreSQL database. You can also link a database container, e. g. `--link my-mysql:mysql`, and then use `mysql` as the database host on setup. More info is in [the docker compose section](https://github.com/nextcloud/docker/?tab=readme-ov-file#running-this-image-with-docker-compose).\n\n## Persistent data\nThe Nextcloud installation and all data beyond what lives in the database (file uploads, etc.) are stored in the [unnamed docker volume](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume) volume `/var/www/html`. The docker daemon will store that data within the docker directory `/var/lib/docker/volumes/...`. That means your data is saved even if the container crashes, is stopped or deleted.\n\nA named Docker volume or a mounted host directory should be used for upgrades and backups. To achieve this, you need one volume for your database container and one for Nextcloud.\n\nNextcloud:\n- `/var/www/html/` folder where all Nextcloud data lives\n```console\n$ docker run -d \\\n-v nextcloud:/var/www/html \\\nnextcloud\n```\n\nDatabase:\n- `/var/lib/mysql` MySQL / MariaDB Data\n- `/var/lib/postgresql/data` PostgreSQL Data\n```console\n$ docker run -d \\\n-v db:/var/lib/mysql \\\nmariadb:lts\n```\n\n### Additional volumes\n\nIf you want to get fine grained access to your individual files, you can mount additional volumes for data, config, your theme and custom apps. The `data`, `config` files are stored in respective subfolders inside `/var/www/html/`. The apps are split into core `apps` (which are shipped with Nextcloud and you don't need to take care of) and a `custom_apps` folder. If you use a custom theme it would go into the `themes` subfolder.\n\nOverview of the folders that can be mounted as volumes:\n\n- `/var/www/html` Main folder, needed for updating\n- `/var/www/html/custom_apps` installed / modified apps\n- `/var/www/html/config` local configuration\n- `/var/www/html/data` the actual data of your Nextcloud\n- `/var/www/html/themes/<YOUR_CUSTOM_THEME>` theming/branding\n\nIf you want to use named volumes for all of these, it would look like this:\n```console\n$ docker run -d \\\n-v nextcloud:/var/www/html \\\n-v custom_apps:/var/www/html/custom_apps \\\n-v config:/var/www/html/config \\\n-v data:/var/www/html/data \\\n-v theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \\\nnextcloud\n```\n\nIf you'd prefer to use bind mounts instead of named volumes, for instance, when working with different device or network mounts for user data files and configuration:\n```console\n$ docker run -d \\\n-v /path/on/host/to/folder/nextcloud:/var/www/html \\\n-v /path/on/host/to/folder/custom_apps:/var/www/html/custom_apps \\\n-v /path/on/host/to/folder/config:/var/www/html/config \\\n-v /path/on/host/to/folder/data:/var/www/html/data \\\n-v /path/on/host/to/folder/theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \\\nnextcloud\n```\n\nHere’s the same example using Docker's more detailed `--mount`. Note that with `-v` or `--volume`, the specified folders are created automatically if they don't exist. However, when using `--mount` for bind mounts, the directories must already exist on the host, or Docker will return an error.\n```console\n$ docker run -d \\\n--mount type=bind,source=/path/on/host/to/folder/nextcloud,target=/var/www/html \\\n--mount type=bind,source=/path/on/host/to/folder/custom_apps,target=/var/www/html/custom_apps \\\n--mount type=bind,source=/path/on/host/to/folder/config,target=/var/www/html/config \\\n--mount type=bind,source=/path/on/host/to/folder/data,target=/var/www/html/data \\\n--mount type=bind,source=/path/on/host/to/folder/theme,target=/var/www/html/themes/<YOUR_CUSTOM_THEME> \\\nnextcloud\n```\nThe examples above use figurative directory `/path/on/host/to/folder/` for bind mounts. Please modify the paths by using either a relative or absolute path.\n\nNOTE: Do not confuse the `apps` and `custom_apps` folders. These folders contain different sets of apps, and mixing them will result in a broken installation. The former contains \"shipped\" apps, which come with Nextcloud Server. The latter contains apps you install from the App Store.\n\n### Custom volumes\n\nIf mounting additional volumes under `/var/www/html`, you should consider:\n- Confirming that [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude) contains the files and folders that should persist during installation and upgrades; or\n- Mounting storage volumes to locations outside of `/var/www/html`.\n\n**Data inside the main folder (`/var/www/html`) will be overridden/removed during installation and upgrades, unless listed in [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude).** The additional volumes officially supported are already in that list, but custom volumes will need to be added by you. We suggest mounting custom storage volumes outside of `/var/www/html` and if possible read-only so that making this adjustment is unnecessary. If you must do so, however, you may build a custom image with a modified `/upgrade.exclude` file that incorporates your custom volume(s).\n\n## Running as an arbitrary user / file permissions / changing the default container user\n\nThe default user within a container is root (uid = 0). By default, processes inside the container will expect to have root privileges. Network services will drop privileges and use `www-data` to serve requests. \n\nDepending on your volumes configuration, this can lead to permission issues. You can address this by running the container with a different default user. When changing the default user, the image will no longer assume it has root privileges and will run all processes under the specified uid. To accomplish this, use the `--user` / `user` option in your container environment.\n\nSee:\n\n- https://docs.docker.com/engine/containers/run/#user\n- https://github.com/docker-library/docs/tree/master/php#running-as-an-arbitrary-user\n- https://docs.podman.io/en/stable/markdown/podman-run.1.html#user-u-user-group\n\n## Accessing the Nextcloud command-line interface (`occ`)\n\nTo use the [Nextcloud command-line interface](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) (aka. `occ` command):\n```console\n$ docker exec -it --user www-data CONTAINER_ID php occ\n```\nor for docker compose:\n```console\n$ docker compose exec --user www-data app php occ\n```\nor even shorter:\n```console\n$ docker compose exec -u33 app ./occ\n```\nNote: substitute `82` for `33` if using the Alpine-based images.\n\n## Viewing the Nextcloud configuration (`config.php`)\n\nThe image takes advantage of Nextcloud's [Multiple config.php support](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file) to inject auto configuration environment variables and set image specific config values.\n\nThis means that merely viewing your `config.php` will not give you an accurate view of your running config. Instead, you should use Nextcloud's [`occ config:list system` command](https://docs.nextcloud.com/server/latest/admin_manual/occ_command.html#config-commands-label) to get get a complete view of your merged configuration. This has the added benefit of automatically omitting sensitive values such as passwords and secrets from the output by default (e.g. useful for shared publicly or assisting others when troubleshooting or reporting a bug).\n\n```console\n$ docker compose exec -u33 app ./occ config:list system\n```\n\nThe `--private` flag can also be specified, in order to output all configuration values including passwords and secrets.\n\n## Auto configuration via environment variables\n\nThe Nextcloud image supports auto configuration of the Nextcloud Server installation via environment variables. You can preconfigure everything that would otherwise be prompted for by the Nextcloud Installation Wizard (as well as a few other key parameters relevant to initial installation). \n\n### Database parameters\n\nTo enable auto configuration, define your database connection via the following environment variables. If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_HOST`), they will not be requested via the Installation Wizard on first run. \n\nYou must specify all of the environment variables for a given database or the database environment variables defaults to SQLITE. ONLY use one database type!\n\n__SQLite__:\n- `SQLITE_DATABASE` Name of the database using sqlite\n\n__MYSQL/MariaDB__:\n- `MYSQL_DATABASE` Name of the database using mysql / mariadb.\n- `MYSQL_USER` Username for the database using mysql / mariadb.\n- `MYSQL_PASSWORD` Password for the database user using mysql / mariadb.\n- `MYSQL_HOST` Hostname of the database server using mysql / mariadb.\n\n__PostgreSQL__:\n- `POSTGRES_DB` Name of the database using postgres.\n- `POSTGRES_USER` Username for the database using postgres.\n- `POSTGRES_PASSWORD` Password for the database user using postgres.\n- `POSTGRES_HOST` Hostname of the database server using postgres.\n\nAs an alternative to passing sensitive information via environment variables, `_FILE` may be appended to the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. See [Docker secrets](#docker-secrets) section below for details.\n\n### Initial admin account\n\nIf you specify all the variables for your database type (above), you can also auto configure your initial admin user and password (only works if you set both):\n\n- `NEXTCLOUD_ADMIN_USER` Name of the Nextcloud admin user.\n- `NEXTCLOUD_ADMIN_PASSWORD` Password for the Nextcloud admin user.\n\nSpecifying a complete database and admin credential config set at initial deployment will result in a fully automated installation (i.e. bypassing the web-based Nextcloud Installation Wizard).\n\nAddition parameters may also be set at installation time and are described below.\n\n### Custom Data directory (`datadirectory`)\n\nIf you don't want to use the default data directory (`datadirectory`) location, you can set a custom one:\n\n- `NEXTCLOUD_DATA_DIR` (default: `/var/www/html/data`) Configures the data directory where nextcloud stores all files from the users.\n\n### Trusted domains (`trusted_domains`)\n\nOne or more trusted domains can be set through environment variable, too. They will be added to the configuration after install.\n\n- `NEXTCLOUD_TRUSTED_DOMAINS` (not set by default) Optional space-separated list of domains\n\n### Image specific\n\nThe install and update script is only triggered when a default command is used (`apache-foreground` or `php-fpm`). If you use a custom command you have to enable the install / update with\n\n- `NEXTCLOUD_UPDATE` (default: `0`)\n\nYou might want to make sure the htaccess is up to date after each container update. Especially on multiple swarm nodes as any discrepancy will make your server unusable.\n\n- `NEXTCLOUD_INIT_HTACCESS` (not set by default) Set it to true to enable run `occ maintenance:update:htaccess` after container initialization.\n\n### Redis Memory Caching\n\nTo use Redis for memory caching as well as PHP session storage, specify the following values and also add a [Redis](https://hub.docker.com/_/redis/) container to your stack. See the [examples](https://github.com/nextcloud/docker/tree/master/.examples) for further instructions.\n\n- `REDIS_HOST` (not set by default) Name of Redis container\n- `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports.\n- `REDIS_HOST_USER` (not set by default) Optional username for Redis, only use for external Redis servers that require a user.\n- `REDIS_HOST_PASSWORD` (not set by default) Redis password\n\nCheck the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information.\n\n### E-mail (SMTP) Configuration\n\nTo use an external SMTP server, you have to provide the connection details. Note that if you configure these values via Docker, you should **not** use the Nexcloud Web UI to configure external SMTP server parameters. Conversely, if you prefer to use the Web UI, do **not** set these variables here (because these variables will override whatever you attempt to set in the Web UI for these parameters). To configure Nextcloud to use SMTP add:\n\n- `SMTP_HOST` (not set by default): The hostname of the SMTP server.\n- `SMTP_SECURE` (empty by default): Set to `ssl` to use SSL, or `tls` to use STARTTLS.\n- `SMTP_PORT` (default: `465` for SSL and `25` for non-secure connections): Optional port for the SMTP connection. Use `587` for an alternative port for STARTTLS.\n- `SMTP_AUTHTYPE` (default: `LOGIN`): The method used for authentication. Use `PLAIN` if no authentication is required.\n- `SMTP_NAME` (empty by default): The username for the authentication.\n- `SMTP_PASSWORD` (empty by default): The password for the authentication.\n- `MAIL_FROM_ADDRESS` (not set by default): Set the local-part for the 'from' field in the emails sent by Nextcloud.\n- `MAIL_DOMAIN` (not set by default): Set a different domain for the emails than the domain where Nextcloud is installed.\n\nAt a minimum, the `SMTP_HOST`, `MAIL_FROM_ADDRESS` and `MAIL_DOMAIN` parameters must be defined.\n\nCheck the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html) for other values to configure SMTP.\n\n### Object Storage (Primary Storage)\n\nBy default, Nextcloud stores all files in `/var/www/html/data/` (or whatever custom data directory you've configured). Nextcloud also allows the use of object storages (like OpenStack \nSwift or any Amazon S3-compatible implementation) as *Primary Storage*. This semi-replaces the default storage of files in the data directory. Note: This data directory might still be \nused for compatibility reasons and still needs to exist. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html) for more information.\n\nTo use an external S3 compatible object store as primary storage, set the following variables:\n- `OBJECTSTORE_S3_BUCKET`: The name of the bucket that Nextcloud should store the data in\n- `OBJECTSTORE_S3_REGION`: The region that the S3 bucket resides in\n- `OBJECTSTORE_S3_HOST`: The hostname of the object storage server\n- `OBJECTSTORE_S3_PORT`: The port that the object storage server is being served over\n- `OBJECTSTORE_S3_KEY`: AWS style access key\n- `OBJECTSTORE_S3_SECRET`: AWS style secret access key\n- `OBJECTSTORE_S3_STORAGE_CLASS`: The storage class to use when adding objects to the bucket\n- `OBJECTSTORE_S3_SSL` (default: `true`): Whether or not SSL/TLS should be used to communicate with object storage server\n- `OBJECTSTORE_S3_USEPATH_STYLE` (default: `false`): Not required for AWS S3\n- `OBJECTSTORE_S3_LEGACYAUTH` (default: `false`): Not required for AWS S3\n- `OBJECTSTORE_S3_OBJECT_PREFIX` (default: `urn:oid:`): Prefix to prepend to the fileid\n- `OBJECTSTORE_S3_AUTOCREATE` (default: `true`): Create the container if it does not exist\n- `OBJECTSTORE_S3_SSE_C_KEY` (not set by default): Base64 encoded key with a maximum length of 32 bytes for server side encryption (SSE-C)\n\nCheck the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) for more information.\n\nTo use an external OpenStack Swift object store as primary storage, set the following variables:\n- `OBJECTSTORE_SWIFT_URL`: The Swift identity (Keystone) endpoint\n- `OBJECTSTORE_SWIFT_AUTOCREATE` (default: `false`): Whether or not Nextcloud should automatically create the Swift container\n- `OBJECTSTORE_SWIFT_USER_NAME`: Swift username\n- `OBJECTSTORE_SWIFT_USER_PASSWORD`: Swift user password\n- `OBJECTSTORE_SWIFT_USER_DOMAIN` (default: `Default`): Swift user domain\n- `OBJECTSTORE_SWIFT_PROJECT_NAME`: OpenStack project name\n- `OBJECTSTORE_SWIFT_PROJECT_DOMAIN` (default: `Default`): OpenStack project domain\n- `OBJECTSTORE_SWIFT_SERVICE_NAME` (default: `swift`): Swift service name\n- `OBJECTSTORE_SWIFT_REGION`: Swift endpoint region\n- `OBJECTSTORE_SWIFT_CONTAINER_NAME`: Swift container (bucket) that Nextcloud should store the data in\n\nCheck the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#openstack-swift) for more information.\n\n### PHP Configuration\n\nTo customize PHP limits you can change the following variables:\n- `PHP_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight.\n- `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information.\n- `PHP_OPCACHE_MEMORY_CONSUMPTION` (default `128`) This sets the `opcache.memory_consumption` value. It's the size of the shared memory storage used by OPcache, in megabytes. \n\n### Apache Configuration\n\nTo customize the Apache max file upload limit you can change the following variable:\n- `APACHE_BODY_LIMIT` (default `1073741824` [1GiB]) This restricts the total\nsize of the HTTP request body sent from the client. It specifies the number of _bytes_ that are allowed in a request body. A value of **0** means **unlimited**.\n\nCheck the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#apache) for more information.\n\n### Using the image behind a reverse proxy and specifying the server host and protocol\n\nBy default, the apache image will replace the remote addr (IP address visible to Nextcloud) with the IP address from `X-Real-IP` if the request is coming from a reverse proxy in `10.0.0.0/8`, `172.16.0.0/12` or `192.168.0.0/16`. If you want Nextcloud to pick up the server host (`HTTP_X_FORWARDED_HOST`), protocol (`HTTP_X_FORWARDED_PROTO`) and client IP (`HTTP_X_FORWARDED_FOR`) from a trusted proxy, then disable rewrite IP and add the reverse proxy's IP address to `TRUSTED_PROXIES`.\n\n- `APACHE_DISABLE_REWRITE_IP` (not set by default): Set to 1 to disable rewrite IP.\n\n- `TRUSTED_PROXIES` (empty by default): A space-separated list of trusted proxies. CIDR notation is supported for IPv4.\n\nIf the `TRUSTED_PROXIES` approach does not work for you, try using fixed values for overwrite parameters.\n\n- `OVERWRITEHOST` (empty by default): Set the hostname of the proxy. Can also specify a port.\n- `OVERWRITEPROTOCOL` (empty by default): Set the protocol of the proxy, http or https.\n- `OVERWRITECLIURL` (empty by default): Set the cli url of the proxy (e.g. https://mydnsname.example.com)\n- `OVERWRITEWEBROOT` (empty by default): Set the absolute path of the proxy.\n- `OVERWRITECONDADDR` (empty by default): Regex to overwrite the values dependent on the remote address.\n- `FORWARDED_FOR_HEADERS` (empty by default): HTTP headers with the original client IP address\n\nCheck the [Nexcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html) for more details.\n\nKeep in mind that once set at install time, removing these environment variables later won't remove them from your `config/config.php`, due to how Nextcloud generates and merges the initial configuration at installation time. They can still, however, be removed manually from your `config/config.php`.\n\n### Handling `Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile` (aka: Auto configuration and Nextcloud updates)\n\nThe image comes with special config files for Nextcloud that set parameters specific to containerized usage (e.g. `upgrade-disable-web.config.php`) or enable auto configuration via environment variables (e.g. `reverse-proxy.config.php`). Not keeping these files up-to-date when this warning appears may cause certain auto configuration environment variables to be ignored or the image to not work as documented or expected.\n\nDuring a fresh Nextcloud installation, the latest version (from the image) of these files are copied into `/var/www/html/config` so that they are stored within your container's persistent storage and picked up by Nextcloud alongside your local configuration.\n\nThe copied files, however, are **not** automatically overwritten whenever you update your environment with a newer Nextcloud image. This is to prevent local changes in `/var/www/html/config` from being unexpectedly overwritten. This may lead to your image-specific configuration files becoming outdated and image functionality not matching that which is documented.\n\nWithin each image, the latest version of these config files are located in `/usr/src/nextcloud/config`.\n\nA warning will be generated in the container log output when outdated image-specific configuration files are detected at startup in a running container. When you see this warning, you should manually compare (or copy) the files from `/usr/src/nextcloud/config` to `/var/www/html/config`.\nA command to copy these configs would e.g. be:\n```console\ndocker exec <container-name> sh -c \"cp /usr/src/nextcloud/config/*.php /var/www/html/config\"\n```\n\nAs long as you have not modified any of the provided config files in `/var/www/html/config` (other than `config.php`) or only added new ones with names that do not conflict with the image specific ones, copying the new ones into place should be safe (but check the source path `/usr/src/nextcloud/config` for any newly named config files to avoid new overlaps just in case).\n\n## Auto configuration via hook folders\n\nThere are 5 hooks\n\n- `pre-installation` Executed before the Nextcloud is installed/initiated\n- `post-installation` Executed after the Nextcloud is installed/initiated\n- `pre-upgrade` Executed before the Nextcloud is upgraded\n- `post-upgrade` Executed after the Nextcloud is upgraded\n- `before-starting` Executed before the Nextcloud starts\n\nTo use the hooks triggered by the `entrypoint` script, either\n- Added your script(s) to the individual of the hook folder(s), which are located at the path `/docker-entrypoint-hooks.d` in the container\n- Use volume(s) if you want to use script from the host system inside the container, see example.\n\n**Note:** Only the script(s) located in a hook folder (not sub-folders), ending with `.sh` and marked as executable, will be executed.\n\n**Example:** Mount using volumes\n```yaml\n...\n  app:\n    image: nextcloud:stable\n\n    volumes:\n      - ./app-hooks/pre-installation:/docker-entrypoint-hooks.d/pre-installation\n      - ./app-hooks/post-installation:/docker-entrypoint-hooks.d/post-installation\n      - ./app-hooks/pre-upgrade:/docker-entrypoint-hooks.d/pre-upgrade\n      - ./app-hooks/post-upgrade:/docker-entrypoint-hooks.d/post-upgrade\n      - ./app-hooks/before-starting:/docker-entrypoint-hooks.d/before-starting\n...\n```\n\n# Running this image with `docker compose`\nThe easiest way to get a fully featured and functional setup is using a `compose.yaml` file. There are too many different possibilities to setup your system, so here are only some examples of what you have to look for.\n\nAt first, make sure you have chosen the right base image (fpm or apache) and added features you wanted (see below). In every case, you would want to add a database container and docker volumes to get easy access to your persistent data. When you want to have your server reachable from the internet, adding HTTPS-encryption is mandatory! See below for more information.\n\n## Base version - apache\nThis version will use the apache variant and add a MariaDB container. The volumes are set to keep your data persistent. This setup provides **no TLS encryption** and is intended to run behind a proxy.\n\nMake sure to pass in values for `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` variables before you run this setup.\n\n```yaml\nservices:\n  # Note: MariaDB is external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    restart: always\n    command: --transaction-isolation=READ-COMMITTED\n    volumes:\n      - db:/var/lib/mysql\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud\n    restart: always\n    ports:\n      - 8080:80\n    depends_on:\n      - redis\n      - db\n    volumes:\n      - nextcloud:/var/www/html\n    environment:\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n      - MYSQL_HOST=db\n\nvolumes:\n  nextcloud:\n  db:\n```\n\nThen run `docker compose up -d`, now you can access Nextcloud at http://localhost:8080/ from your host system.\n\n## Base version - FPM\nWhen using the FPM image, you need another container that acts as web server on port 80 and proxies the requests to the Nextcloud container. In this example a simple nginx container is combined with the Nextcloud-fpm image and a MariaDB database container. The data is stored in docker volumes. The nginx container also needs access to static files from your Nextcloud installation. It gets access to all the volumes mounted to Nextcloud via the `volumes` option. The configuration for nginx is stored in the configuration file `nginx.conf`, that is mounted into the container. An example can be found in the examples section [here](https://github.com/nextcloud/docker/tree/master/.examples).\n\nThis setup provides **no TLS encryption** and is intended to run behind a reverse proxy.\n\nMake sure to pass in values for `MYSQL_ROOT_PASSWORD` and `MYSQL_PASSWORD` variables before you run this setup.\n\n```yaml\nservices:\n  # Note: MariaDB is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/mariadb\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: mariadb:lts\n    restart: always\n    command: --transaction-isolation=READ-COMMITTED\n    volumes:\n      - db:/var/lib/mysql\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud:fpm\n    restart: always\n    depends_on:\n      - redis\n      - db\n    volumes:\n      - nextcloud:/var/www/html\n    environment:\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n      - MYSQL_HOST=db\n\n  # Note: Nginx is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/nginx/\n  web:\n    image: nginx:alpine-slim\n    restart: always\n    ports:\n      - 8080:80\n    depends_on:\n      - app\n    volumes:\n      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html\n      - ./nginx.conf:/etc/nginx/nginx.conf:ro \n    volumes_from:\n      - app\n\nvolumes:\n  nextcloud:\n  db:\n```\n\nThen run `docker compose up -d`, now you can access Nextcloud at http://localhost:8080/ from your host system.\n\n# Docker Secrets\n\nAs an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files. \n\nCurrently, this is only supported for `NEXTCLOUD_ADMIN_PASSWORD`, `NEXTCLOUD_ADMIN_USER`, `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`, `POSTGRES_DB`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, `REDIS_HOST_PASSWORD`, `SMTP_PASSWORD`, `OBJECTSTORE_S3_KEY`, and `OBJECTSTORE_S3_SECRET`. \n\nIf you set any group of `_FILE` based values (i.e. all of `MYSQL_DATABASE_FILE`, `MYSQL_USER_FILE`, `MYSQL_PASSWORD_FILE`), their non-`_FILE` counterparts will be ignored (`MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`).\n\nAny files containing secrets must be readable by the UID the container is running Nextcloud as (i.e. `www-data` / `33`).\n\nExample:\n\n```yaml\nservices:\n  # Note: PostgreSQL is external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/postgres\n  db:\n    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server\n    image: postgres:alpine\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data\n    environment:\n      - POSTGRES_DB_FILE=/run/secrets/postgres_db\n      - POSTGRES_USER_FILE=/run/secrets/postgres_user\n      - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password\n    secrets:\n      - postgres_db\n      - postgres_password\n      - postgres_user\n  # Note: Redis is an external service. You can find more information about the configuration here:\n  # https://hub.docker.com/_/redis\n  redis:\n    image: redis:alpine\n    restart: always\n\n  app:\n    image: nextcloud\n    restart: always\n    ports:\n      - 8080:80\n    volumes:\n      - nextcloud:/var/www/html\n    environment:\n      - POSTGRES_HOST=db\n      - POSTGRES_DB_FILE=/run/secrets/postgres_db\n      - POSTGRES_USER_FILE=/run/secrets/postgres_user\n      - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password\n      - NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/nextcloud_admin_password\n      - NEXTCLOUD_ADMIN_USER_FILE=/run/secrets/nextcloud_admin_user\n    depends_on:\n      - redis\n      - db\n    secrets:\n      - nextcloud_admin_password\n      - nextcloud_admin_user\n      - postgres_db\n      - postgres_password\n      - postgres_user\n\nvolumes:\n  db:\n  nextcloud:\n\nsecrets:\n  nextcloud_admin_password:\n    file: ./nextcloud_admin_password.txt # put admin password in this file\n  nextcloud_admin_user:\n    file: ./nextcloud_admin_user.txt # put admin username in this file\n  postgres_db:\n    file: ./postgres_db.txt # put postgresql db name in this file\n  postgres_password:\n    file: ./postgres_password.txt # put postgresql password in this file\n  postgres_user:\n    file: ./postgres_user.txt # put postgresql username in this file\n```\n\n# Make your Nextcloud available from the internet\nUntil here, your Nextcloud is just available from your docker host. If you want your Nextcloud available from the internet adding SSL encryption is mandatory.\n\n## HTTPS - SSL encryption\nThere are many different possibilities to introduce encryption depending on your setup.\n\nWe recommend using a reverse proxy in front of your Nextcloud installation. Your Nextcloud will only be reachable through the proxy, which encrypts all traffic to the clients. You can mount your manually generated certificates to the proxy or use a fully automated solution which generates and renews the certificates for you.\n\nIn our [examples](https://github.com/nextcloud/docker/tree/master/.examples) section we have an example for a fully automated setup using a reverse proxy, a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling, database and Nextcloud. It uses the popular [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [acme-companion](https://github.com/nginx-proxy/acme-companion) containers. Please check the according documentations before using this setup.\n\n# First use\nWhen you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account username, password and the database connection (unless of course you've provided all the necessary auto-config config values ahead of time). \n\nFor the database use `db` as host and `nextcloud` as table and user name. Also enter the password you chose in your `compose.yaml` file.\n\n# Update to a newer version\nUpdating the Nextcloud container is done by pulling the new image, throwing away the old container and starting the new one.\n\n**It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.**\n\nSince all data is stored in volumes, nothing gets lost. The startup script will check for the version in your volume and the installed docker version. If it finds a mismatch, it automatically starts the upgrade process. Don't forget to add all the volumes to your new container, so it works as expected.\n\n```console\n$ docker pull nextcloud\n$ docker stop <your_nextcloud_container>\n$ docker rm <your_nextcloud_container>\n$ docker run <OPTIONS> -d nextcloud\n```\nBeware that you have to run the same command with the options that you used to initially start your Nextcloud. That includes  volumes, port mapping.\n\nWhen using docker compose your compose file takes care of your configuration, so you just have to run:\n\n```console\n$ docker compose pull\n$ docker compose up -d\n```\n\n\n# Adding Features\nA lot of people want to use additional functionality inside their Nextcloud installation. If the image does not include the packages you need, you can easily build your own image on top of it. Start your derived image with the `FROM` statement and add whatever you like.\n\n```dockerfile\nFROM nextcloud:apache\n\nRUN ...\n\n```\nThe [examples folder](https://github.com/nextcloud/docker/blob/master/.examples) gives a few examples on how to add certain functionalities, like including the cron job, smb-support or imap-authentication.\n\nIf you use your own Dockerfile, you need to configure your docker compose file accordingly. Switch out the `image` option with `build`. You have to specify the path to your Dockerfile. (in the example it's in the same directory next to the `compose.yaml` file)\n\n```yaml\n  app:\n    build: .\n    restart: always\n    depends_on:\n      - db\n    volumes:\n      - data:/var/www/html/data\n      - config:/var/www/html/config\n      - apps:/var/www/html/apps\n```\n\nIf you intend to use another command to run the image, make sure that you set `NEXTCLOUD_UPDATE=1` in your Dockerfile. Otherwise the installation and update will not work.\n\n```dockerfile\nFROM nextcloud:apache\n\n...\n\nENV NEXTCLOUD_UPDATE=1\n\nCMD [\"/usr/bin/supervisord\"]\n```\n\n\n**Updating** your own derived image is also very simple. When a new version of the Nextcloud image is available run:\n\n```console\ndocker build -t your-name --pull .\ndocker run -d your-name\n```\n\nor for docker compose:\n```console\ndocker compose build --pull\ndocker compose up -d\n```\n\nThe `--pull` option tells docker to look for new versions of the base image. Then the build instructions inside your `Dockerfile` are run on top of the new image.\n\n# Migrating an existing installation\nYou're already using Nextcloud and want to switch to docker? Great! Here are some things to look out for:\n\n1. Define your whole Nextcloud infrastructure in a `compose.yaml` file and run it with `docker compose up -d` to get the base installation, volumes and database. Work from there.\n2. Restore your database from a mysqldump (db is the name of your database container / service name)\n    - To import from a MySQL dump use the following commands\n    ```console\n    docker compose cp ./database.dmp db:/dmp\n    docker compose exec db sh -c \"mysql --user USER --password PASSWORD nextcloud < /dmp\"\n    docker compose exec db rm /dmp\n    ```\n    - To import from a PostgreSQL dump use to following commands\n    ```console\n    docker compose cp ./database.dmp db:/dmp\n    docker compose exec db sh -c \"psql -U USER --set ON_ERROR_STOP=on nextcloud < /dmp\"\n    docker compose exec db rm /dmp\n    ```\n3. Edit your config.php\n    1. Set database connection\n        - In case of MySQL database\n        ```php\n        'dbhost' => 'db:3306',\n        ```\n        - In case of PostgreSQL database\n        ```php\n        'dbhost' => 'db:5432',\n        ```\n    2. Make sure you have no configuration for the `apps_paths`. Delete lines like these\n        ```php\n        'apps_paths' => array (\n            0 => array (\n                'path' => OC::$SERVERROOT.'/apps',\n                'url' => '/apps',\n                'writable' => true,\n            ),\n        ),\n        ```\n    3. Make sure to have the `apps` directory non writable and the `custom_apps` directory writable\n        ```php\n        'apps_paths' => array (\n          0 => array (\n            'path' => '/var/www/html/apps',\n            'url' => '/apps',\n            'writable' => false,\n          ),\n          1 => array (\n            'path' => '/var/www/html/custom_apps',\n            'url' => '/custom_apps',\n            'writable' => true,\n          ),\n        ),\n        ```\n    4. Make sure your data directory is set to /var/www/html/data\n        ```php\n        'datadirectory' => '/var/www/html/data',\n        ```\n4. Copy your data (`app` is the name of your Nextcloud container / service name):\n    ```console\n    docker compose cp ./data/ app:/var/www/html/\n    docker compose exec app chown -R www-data:www-data /var/www/html/data\n    docker compose cp ./theming/ app:/var/www/html/\n    docker compose exec app chown -R www-data:www-data /var/www/html/theming\n    docker compose cp ./config/config.php app:/var/www/html/config\n    docker compose exec app chown -R www-data:www-data /var/www/html/config\n    ```\n    If you want to preserve the metadata of your files like timestamps, copy the data directly on the host to the named volume using plain `cp` like this:\n    ```console\n    cp --preserve --recursive ./data/ /path/to/nextcloudVolume/data\n    ```\n5. Copy only the custom apps you use (or simply redownload them from the web interface):\n    ```console\n    docker compose cp ./custom_apps/ app:/var/www/html/\n    docker compose exec app chown -R www-data:www-data /var/www/html/custom_apps\n    ```\n\n## Migrating from a non-Alpine image to an Alpine image\n\nIf you already use one of our non-Alpine images, but want to switch to an Alpine-based image, you may experience permissions problems with your existing volumes. This is because the Alpine images uses a different user ID for `www-data`. \nSo, you must change the ownership of the `/var/www/html` (or `$NEXTCLOUD_DATA_DIR`) folder to be compatible with Alpine:\n\n```console\ndocker exec container-name chown -R www-data:root /var/www/html\n```\n\nAfter changing the permissions, restart the container and the permission errors should disappear.\n\n# Reporting bugs or suggesting enhancements\n\nIf you believe you've found a bug in the image itself (or have an enhancement idea specific to the image), please [search for already reported bugs and enhancement ideas](https://github.com/nextcloud/docker/issues). \n\nIf there is a relevant existing open issue, you can either add to the discussion there or upvote it to indicate you're impacted by (or interested in) the same issue. \n\nIf you believe you've found a new bug, please create a new Issue so that others can try to reproduce it and remediation can be tracked.\n\n![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/nextcloud/docker?label=Open%20Issues)\n![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/bug?style=flat&label=Bug%20Reports&color=red)\n![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/enhancement?style=flat&label=Enhancement%20Ideas&color=green)\n![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/good%20first%20issue?style=flat&label=Good%20First%20Issues)\n\n**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as \"bugs\" (unless they really are bugs of course). This helps the \nmaintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests \non the [Nextcloud Community Help Forum](https://help.nextcloud.com).)\n\n[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)\n[![Discourse Posts](https://img.shields.io/discourse/posts?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)\n\nMost Nextcloud Server matters are covered in the official [Nextcloud Admin Manual](https://docs.nextcloud.com/server/latest/admin_manual/) or the [other official Nextcloud documentation](https://docs.nextcloud.com) (which are routinely updated).\n"
  },
  {
    "path": "docker-cron.sh",
    "content": "#!/bin/sh\nset -eu\n\nexec busybox crond -f -L /dev/stdout\n"
  },
  {
    "path": "docker-entrypoint.sh",
    "content": "#!/bin/sh\nset -eu\n\n# version_greater A B returns whether A > B\nversion_greater() {\n    [ \"$(printf '%s\\n' \"$@\" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)\" != \"$1\" ]\n}\n\n# return true if specified directory is empty\ndirectory_empty() {\n    [ -z \"$(ls -A \"$1/\")\" ]\n}\n\nrun_as() {\n    if [ \"$(id -u)\" = 0 ]; then\n        su -p \"$user\" -s /bin/sh -c \"$1\"\n    else\n        sh -c \"$1\"\n    fi\n}\n\n# Execute all executable files in a given directory in alphanumeric order\nrun_path() {\n    local hook_folder_path=\"/docker-entrypoint-hooks.d/$1\"\n    local return_code=0\n    local found=0\n\n    echo \"=> Searching for hook scripts (*.sh) to run, located in the folder \\\"${hook_folder_path}\\\"\"\n\n    if ! [ -d \"${hook_folder_path}\" ] || directory_empty \"${hook_folder_path}\"; then\n        echo \"==> Skipped: the \\\"$1\\\" folder is empty (or does not exist)\"\n        return 0\n    fi\n\n    find \"${hook_folder_path}\" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | (\n        while read -r script_file_path; do\n            if ! [ -x \"${script_file_path}\" ]; then\n                echo \"==> The script \\\"${script_file_path}\\\" was skipped, because it lacks the executable flag\"\n                found=$((found-1))\n                continue\n            fi\n\n            echo \"==> Running the script (cwd: $(pwd)): \\\"${script_file_path}\\\"\"\n            found=$((found+1))\n            run_as \"${script_file_path}\" || return_code=\"$?\"\n\n            if [ \"${return_code}\" -ne \"0\" ]; then\n                echo \"==> Failed at executing script \\\"${script_file_path}\\\". Exit code: ${return_code}\"\n                exit 1\n            fi\n\n            echo \"==> Finished executing the script: \\\"${script_file_path}\\\"\"\n        done\n        if [ \"$found\" -lt \"1\" ]; then\n            echo \"==> Skipped: the \\\"$1\\\" folder does not contain any valid scripts\"\n        else\n            echo \"=> Completed executing scripts in the \\\"$1\\\" folder\"\n        fi\n    )\n}\n\n# usage: file_env VAR [DEFAULT]\n#    ie: file_env 'XYZ_DB_PASSWORD' 'example'\n# (will allow for \"$XYZ_DB_PASSWORD_FILE\" to fill in the value of\n#  \"$XYZ_DB_PASSWORD\" from a file, especially for Docker's secrets feature)\nfile_env() {\n    local var=\"$1\"\n    local fileVar=\"${var}_FILE\"\n    local def=\"${2:-}\"\n    local varValue=$(env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\")\n    local fileVarValue=$(env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\")\n    if [ -n \"${varValue}\" ] && [ -n \"${fileVarValue}\" ]; then\n        echo >&2 \"error: both $var and $fileVar are set (but are exclusive)\"\n        exit 1\n    fi\n    if [ -n \"${varValue}\" ]; then\n        export \"$var\"=\"${varValue}\"\n    elif [ -n \"${fileVarValue}\" ]; then\n        export \"$var\"=\"$(cat \"${fileVarValue}\")\"\n    elif [ -n \"${def}\" ]; then\n        export \"$var\"=\"$def\"\n    fi\n    unset \"$fileVar\"\n}\n\nif expr \"$1\" : \"apache\" 1>/dev/null; then\n    if [ -n \"${APACHE_DISABLE_REWRITE_IP+x}\" ]; then\n        a2disconf remoteip\n    fi\nfi\n\nif expr \"$1\" : \"apache\" 1>/dev/null || [ \"$1\" = \"php-fpm\" ] || [ \"${NEXTCLOUD_UPDATE:-0}\" -eq 1 ]; then\n    uid=\"$(id -u)\"\n    gid=\"$(id -g)\"\n    if [ \"$uid\" = '0' ]; then\n        case \"$1\" in\n            apache2*)\n                user=\"${APACHE_RUN_USER:-www-data}\"\n                group=\"${APACHE_RUN_GROUP:-www-data}\"\n\n                # strip off any '#' symbol ('#1000' is valid syntax for Apache)\n                user=\"${user#'#'}\"\n                group=\"${group#'#'}\"\n                ;;\n            *) # php-fpm\n                user='www-data'\n                group='www-data'\n                ;;\n        esac\n    else\n        user=\"$uid\"\n        group=\"$gid\"\n    fi\n\n    if [ -n \"${REDIS_HOST+x}\" ]; then\n\n        echo \"Configuring Redis as session handler\"\n        {\n            file_env REDIS_HOST_PASSWORD\n            echo 'session.save_handler = redis'\n            # check if redis host is an unix socket path\n            if [ \"$(echo \"$REDIS_HOST\" | cut -c1-1)\" = \"/\" ]; then\n              if [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                  echo \"session.save_path = \\\"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n              else\n                echo \"session.save_path = \\\"unix://${REDIS_HOST}\\\"\"\n              fi\n            # check if redis password has been set\n            elif [ -n \"${REDIS_HOST_PASSWORD+x}\" ]; then\n                if [ -n \"${REDIS_HOST_USER+x}\" ]; then\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\\\"\"\n                else\n                    echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\\\"\"\n                fi\n            else\n                echo \"session.save_path = \\\"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\\\"\"\n            fi\n            echo \"redis.session.locking_enabled = 1\"\n            echo \"redis.session.lock_retries = -1\"\n            # redis.session.lock_wait_time is specified in microseconds.\n            # Wait 10ms before retrying the lock rather than the default 2ms.\n            echo \"redis.session.lock_wait_time = 10000\"\n        } > /usr/local/etc/php/conf.d/redis-session.ini\n    fi\n\n    # If another process is syncing the html folder, wait for\n    # it to be done, then escape initalization.\n    (\n        if ! flock -n 9; then\n            # If we couldn't get it immediately, show a message, then wait for real\n            echo \"Another process is initializing Nextcloud. Waiting...\"\n            flock 9\n        fi\n\n        installed_version=\"0.0.0.0\"\n        if [ -f /var/www/html/version.php ]; then\n            # shellcheck disable=SC2016\n            installed_version=\"$(php -r 'require \"/var/www/html/version.php\"; echo implode(\".\", $OC_Version);')\"\n        fi\n        # shellcheck disable=SC2016\n        image_version=\"$(php -r 'require \"/usr/src/nextcloud/version.php\"; echo implode(\".\", $OC_Version);')\"\n\n        if version_greater \"$installed_version\" \"$image_version\"; then\n            echo \"Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?\"\n            exit 1\n        fi\n\n        if version_greater \"$image_version\" \"$installed_version\"; then\n            echo \"Initializing nextcloud $image_version ...\"\n            if [ \"$installed_version\" != \"0.0.0.0\" ]; then\n                if [ \"${image_version%%.*}\" -gt \"$((${installed_version%%.*} + 1))\" ]; then\n                    echo \"Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported.\"\n                    echo \"It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.\"\n                    exit 1\n                fi\n                echo \"Upgrading nextcloud from $installed_version ...\"\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_before\n            fi\n            if [ \"$(id -u)\" = 0 ]; then\n                rsync_options=\"-rlDog --chown $user:$group\"\n            else\n                rsync_options=\"-rlD\"\n            fi\n\n            rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/\n            for dir in config data custom_apps themes; do\n                if [ ! -d \"/var/www/html/$dir\" ] || directory_empty \"/var/www/html/$dir\"; then\n                    rsync $rsync_options --include \"/$dir/\" --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n                fi\n            done\n            rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/\n\n            # Install\n            if [ \"$installed_version\" = \"0.0.0.0\" ]; then\n                echo \"New nextcloud instance\"\n\n                file_env NEXTCLOUD_ADMIN_PASSWORD\n                file_env NEXTCLOUD_ADMIN_USER\n\n                install=false\n                if [ -n \"${NEXTCLOUD_ADMIN_USER+x}\" ] && [ -n \"${NEXTCLOUD_ADMIN_PASSWORD+x}\" ]; then\n                    # shellcheck disable=SC2016\n                    install_options='-n --admin-user \"$NEXTCLOUD_ADMIN_USER\" --admin-pass \"$NEXTCLOUD_ADMIN_PASSWORD\"'\n                    if [ -n \"${NEXTCLOUD_DATA_DIR+x}\" ]; then\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --data-dir \"$NEXTCLOUD_DATA_DIR\"'\n                    fi\n\n                    file_env MYSQL_DATABASE\n                    file_env MYSQL_PASSWORD\n                    file_env MYSQL_USER\n                    file_env POSTGRES_DB\n                    file_env POSTGRES_PASSWORD\n                    file_env POSTGRES_USER\n\n                    if [ -n \"${SQLITE_DATABASE+x}\" ]; then\n                        echo \"Installing with SQLite database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database-name \"$SQLITE_DATABASE\"'\n                        install=true\n                    elif [ -n \"${MYSQL_DATABASE+x}\" ] && [ -n \"${MYSQL_USER+x}\" ] && [ -n \"${MYSQL_PASSWORD+x}\" ] && [ -n \"${MYSQL_HOST+x}\" ]; then\n                        echo \"Installing with MySQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database mysql --database-name \"$MYSQL_DATABASE\" --database-user \"$MYSQL_USER\" --database-pass \"$MYSQL_PASSWORD\" --database-host \"$MYSQL_HOST\"'\n                        install=true\n                    elif [ -n \"${POSTGRES_DB+x}\" ] && [ -n \"${POSTGRES_USER+x}\" ] && [ -n \"${POSTGRES_PASSWORD+x}\" ] && [ -n \"${POSTGRES_HOST+x}\" ]; then\n                        echo \"Installing with PostgreSQL database\"\n                        # shellcheck disable=SC2016\n                        install_options=$install_options' --database pgsql --database-name \"$POSTGRES_DB\" --database-user \"$POSTGRES_USER\" --database-pass \"$POSTGRES_PASSWORD\" --database-host \"$POSTGRES_HOST\"'\n                        install=true\n                    fi\n\n                    if [ \"$install\" = true ]; then\n                        run_path pre-installation\n\n                        echo \"Starting nextcloud installation\"\n                        max_retries=10\n                        try=0\n                        until  [ \"$try\" -gt \"$max_retries\" ] || run_as \"php /var/www/html/occ maintenance:install $install_options\" \n                        do\n                            echo \"Retrying install...\"\n                            try=$((try+1))\n                            sleep 10s\n                        done\n                        if [ \"$try\" -gt \"$max_retries\" ]; then\n                            echo \"Installing of nextcloud failed!\"\n                            exit 1\n                        fi\n                        if [ -n \"${NEXTCLOUD_TRUSTED_DOMAINS+x}\" ]; then\n                            echo \"Setting trusted domains…\"\n\t\t\t    set -f # turn off glob\n                            NC_TRUSTED_DOMAIN_IDX=1\n                            for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do\n                                DOMAIN=$(echo \"${DOMAIN}\" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\n                                run_as \"php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\\\"${DOMAIN}\\\"\"\n                                NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))\n                            done\n\t\t\t    set +f # turn glob back on\n                        fi\n\n                        run_path post-installation\n\t\t    fi\n                fi\n\t\t# not enough specified to do a fully automated installation \n                if [ \"$install\" = false ]; then \n                    echo \"Next step: Access your instance to finish the web-based installation!\"\n                    echo \"Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.\"\n                fi\n            # Upgrade\n            else\n                run_path pre-upgrade\n\n                run_as 'php /var/www/html/occ upgrade'\n\n                run_as 'php /var/www/html/occ app:list' | sed -n \"/Enabled:/,/Disabled:/p\" > /tmp/list_after\n                echo \"The following apps have been disabled:\"\n                diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1\n                rm -f /tmp/list_before /tmp/list_after\n\n                run_path post-upgrade\n            fi\n\n            echo \"Initializing finished\"\n        fi\n\n        # Update htaccess after init if requested\n        if [ -n \"${NEXTCLOUD_INIT_HTACCESS+x}\" ] && [ \"$installed_version\" != \"0.0.0.0\" ]; then\n            run_as 'php /var/www/html/occ maintenance:update:htaccess'\n        fi\n    ) 9> /var/www/html/nextcloud-init-sync.lock\n\n    # warn if config files on persistent storage differ from the latest version of this image\n    for cfgPath in /usr/src/nextcloud/config/*.php; do\n        cfgFile=$(basename \"$cfgPath\")\n\n        if [ \"$cfgFile\" != \"config.sample.php\" ] && [ \"$cfgFile\" != \"autoconfig.php\" ]; then\n            if ! cmp -s \"/usr/src/nextcloud/config/$cfgFile\" \"/var/www/html/config/$cfgFile\"; then\n                echo \"Warning: /var/www/html/config/$cfgFile differs from the latest version of this image at /usr/src/nextcloud/config/$cfgFile\"\n            fi\n        fi\n    done\n\n    run_path before-starting\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "generate-stackbrew-library.sh",
    "content": "#!/usr/bin/env bash\nset -Eeuo pipefail\n\nstable_channel='32.0.6'\n\nself=\"$(basename \"$BASH_SOURCE\")\"\ncd \"$(dirname \"$(readlink -f \"$BASH_SOURCE\")\")\"\n\n# Get the most recent commit which modified any of \"$@\".\nfileCommit() {\n\tcommit=\"$(git log -1 --format='format:%H' HEAD -- \"$@\")\"\n\tif [ -z \"$commit\" ]; then\n\t\t# return some valid sha1 hash to make bashbrew happy\n\t\techo '0000000000000000000000000000000000000000'\n\telse\n\t\techo \"$commit\"\n\tfi\n}\n\n# Get the most recent commit which modified \"$1/Dockerfile\" or any file that\n# the Dockerfile copies into the rootfs (with COPY).\ndockerfileCommit() {\n\tlocal dir=\"$1\"; shift\n\t(\n\t\tcd \"$dir\";\n\t\tfileCommit Dockerfile \\\n\t\t\t$(awk '\n\t\t\t\ttoupper($1) == \"COPY\" {\n\t\t\t\t\tfor (i = 2; i < NF; i++)\n\t\t\t\t\t\t\tprint $i;\n\t\t\t\t}\n\t\t\t' Dockerfile)\n\t)\n}\n\ngetArches() {\n\tlocal repo=\"$1\"; shift\n\tlocal officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'\n\n\teval \"declare -g -A parentRepoToArches=( $(\n\t\tfind -maxdepth 3 -name 'Dockerfile' -exec awk '\n\t\t\t\ttoupper($1) == \"FROM\" && $2 !~ /^('\"$repo\"'|scratch|microsoft\\/[^:]+)(:|$)/ {\n\t\t\t\t\tprint \"'\"$officialImagesUrl\"'\" $2\n\t\t\t\t}\n\t\t\t' '{}' + \\\n\t\t\t| sort -u \\\n\t\t\t| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]=\"{{ join \" \" .TagEntry.Architectures }}\"'\n\t) )\"\n}\ngetArches 'nextcloud'\n\n# Header.\ncat <<-EOH\n# This file is generated via https://github.com/nextcloud/docker/blob/$(fileCommit \"$self\")/$self\n\nMaintainers: Nextcloud <docker@nextcloud.com> (@nextcloud)\nGitRepo: https://github.com/nextcloud/docker.git\nEOH\n\n# prints \"$2$1$3$1...$N\"\njoin() {\n\tlocal sep=\"$1\"; shift\n\tlocal out; printf -v out \"${sep//%/%%}%s\" \"$@\"\n\techo \"${out#$sep}\"\n}\n\nlatest=$( cat latest.txt )\n\n# Generate each of the tags.\nversions=( */ )\nversions=( \"${versions[@]%/}\" )\nfor version in \"${versions[@]}\"; do\n\tvariants=( $version/*/ )\n\tvariants=( $(for variant in \"${variants[@]%/}\"; do\n\t\techo \"$(basename \"$variant\")\"\n\tdone) )\n\tfor variant in \"${variants[@]}\"; do\n\t\tcommit=\"$(dockerfileCommit \"$version/$variant\")\"\n\t\tfullversion_with_extension=\"$( awk '$1 == \"ENV\" && $2 == \"NEXTCLOUD_VERSION\" { print $3; exit }' \"$version/$variant/Dockerfile\" )\"\n\t\tfullversion=\"$( echo \"$fullversion_with_extension\" | grep -oE '[[:digit:]]+(\\.[[:digit:]]+){2}')\"\n\n\t\tversionAliases=( )\n\t\tversionPostfix=\"\"\n\t\tif [ \"$fullversion_with_extension\" != \"$fullversion\" ]; then\n\t\t\tversionAliases=( \"$fullversion_with_extension\" )\n\t\t\tversionPostfix=\"-$( echo \"$fullversion_with_extension\" | tr '[:upper:]' '[:lower:]' | grep -oE '(beta|rc|alpha)')\"\n\t\tfi\n\n\t\tversionAliases+=( \"$fullversion$versionPostfix\" \"${fullversion%.*}$versionPostfix\" \"${fullversion%.*.*}$versionPostfix\" )\n\t\tif [ \"$fullversion_with_extension\" = \"$latest\" ]; then\n\t\t\tversionAliases+=( \"latest\" )\n\t\tfi\n\n\t\tif [ \"$fullversion_with_extension\" = \"$stable_channel\" ]; then\n\t\t\tversionAliases+=( \"stable\" \"production\" )\n\t\tfi\n\n\t\tvariantAliases=( \"${versionAliases[@]/%/-$variant}\" )\n\t\tvariantAliases=( \"${variantAliases[@]//latest-}\" )\n\n\t\tif [ \"$variant\" = \"apache\" ]; then\n\t\t\tvariantAliases+=( \"${versionAliases[@]}\" )\n\t\tfi\n\n\t\tvariantParent=\"$(awk 'toupper($1) == \"FROM\" { print $2 }' \"$version/$variant/Dockerfile\")\"\n\t\tvariantArches=\"${parentRepoToArches[$variantParent]}\"\n\n\t\tcat <<-EOE\n\n\t\t\tTags: $(join ', ' \"${variantAliases[@]}\")\n\t\t\tArchitectures: $(join ', ' $variantArches)\n\t\t\tGitCommit: $commit\n\t\t\tDirectory: $version/$variant\n\t\tEOE\n\tdone\ndone\n"
  },
  {
    "path": "latest.txt",
    "content": "33.0.0\n"
  },
  {
    "path": "stack.yml",
    "content": "version: '3.2'\n\nservices:\n  db:\n    image: postgres\n    restart: always\n    volumes:\n      - db:/var/lib/postgresql/data\n    environment:\n      - POSTGRES_DB=nextcloud\n      - POSTGRES_USER=nextcloud\n      - POSTGRES_PASSWORD=nextcloud\n\n  app:\n    image: nextcloud\n    restart: always\n    ports:\n      - 8080:80\n    volumes:\n      - nextcloud:/var/www/html\n    environment:\n      - POSTGRES_HOST=db\n      - POSTGRES_DB=nextcloud\n      - POSTGRES_USER=nextcloud\n      - POSTGRES_PASSWORD=nextcloud\n    depends_on:\n      - db\n\n  cron:\n    image: nextcloud\n    restart: always\n    volumes:\n      - nextcloud:/var/www/html\n    entrypoint: /cron.sh\n    depends_on:\n      - db\n\nvolumes:\n  db:\n  nextcloud:\n"
  },
  {
    "path": "update.sh",
    "content": "#!/usr/bin/env bash\nset -eo pipefail\n\ndeclare -A alpine_version=(\n\t[default]='3.23'\n)\n\ndeclare -A debian_version=(\n\t[default]='trixie'\n)\n\ndeclare -A php_version=(\n\t[31]='8.3'\n\t[32]='8.3'\n\t[default]='8.4'\n)\n\ndeclare -A ftp_options=(\n\t[31]='--with-openssl-dir=/usr'\n\t[32]='--with-openssl-dir=/usr'\n\t[default]='--with-ftp-ssl'\n)\n\ndeclare -A cmd=(\n\t[apache]='apache2-foreground'\n\t[fpm]='php-fpm'\n\t[fpm-alpine]='php-fpm'\n)\n\ndeclare -A base=(\n\t[apache]='debian'\n\t[fpm]='debian'\n\t[fpm-alpine]='alpine'\n)\n\ndeclare -A extras=(\n\t[apache]='\\nRUN a2enmod headers rewrite remoteip ; \\\\\\n    { \\\\\\n     echo '\\''RemoteIPHeader X-Real-IP'\\''; \\\\\\n     echo '\\''RemoteIPInternalProxy 10.0.0.0/8'\\''; \\\\\\n     echo '\\''RemoteIPInternalProxy 172.16.0.0/12'\\''; \\\\\\n     echo '\\''RemoteIPInternalProxy 192.168.0.0/16'\\''; \\\\\\n    } > /etc/apache2/conf-available/remoteip.conf; \\\\\\n    a2enconf remoteip\\n\\n# set apache config LimitRequestBody\\nENV APACHE_BODY_LIMIT 1073741824\\nRUN { \\\\\\n     echo '\\''LimitRequestBody ${APACHE_BODY_LIMIT}'\\''; \\\\\\n    } > /etc/apache2/conf-available/apache-limits.conf; \\\\\\n    a2enconf apache-limits'\n\t[fpm]=''\n\t[fpm-alpine]=''\n)\n\ndeclare -A crontab_int=(\n\t[default]='5'\n)\n\napcu_version=\"$(\n\tgit ls-remote --tags https://github.com/krakjoe/apcu.git \\\n\t\t| cut -d/ -f3 \\\n\t\t| grep -viE -- 'rc|b' \\\n\t\t| sed -E 's/^v//' \\\n\t\t| sort -V \\\n\t\t| tail -1\n)\"\n\nigbinary_version=\"$(\n\tgit ls-remote --tags https://github.com/igbinary/igbinary.git \\\n\t\t| cut -d/ -f3 \\\n\t\t| grep -viE '[a-z]' \\\n\t\t| tr -d '^{}' \\\n\t\t| sort -V \\\n\t\t| tail -1\n)\"\n\nimagick_version=\"$(\n\tgit ls-remote --tags https://github.com/imagick/imagick.git \\\n\t\t| cut -d/ -f3 \\\n\t\t| grep -viE '[a-z]' \\\n\t\t| tr -d '^{}' \\\n\t\t| sort -V \\\n\t\t| tail -1\n)\"\n\nmemcached_version=\"$(\n\tgit ls-remote --tags https://github.com/php-memcached-dev/php-memcached.git \\\n\t\t| cut -d/ -f3 \\\n\t\t| grep -viE -- 'rc|b' \\\n\t\t| sed -E 's/^[rv]//' \\\n\t\t| sort -V \\\n\t\t| tail -1\n)\"\n\nredis_version=\"$(\n\tgit ls-remote --tags https://github.com/phpredis/phpredis.git \\\n\t\t| cut -d/ -f3 \\\n\t\t| grep -viE '[a-z]' \\\n\t\t| tr -d '^{}' \\\n\t\t| sort -V \\\n\t\t| tail -1\n)\"\n\ndeclare -A pecl_versions=(\n\t[APCu]=\"$apcu_version\"\n\t[igbinary]=\"$igbinary_version\"\n\t[imagick]=\"$imagick_version\"\n\t[memcached]=\"$memcached_version\"\n\t[redis]=\"$redis_version\"\n)\n\nvariants=(\n\tapache\n\tfpm\n\tfpm-alpine\n)\n\nmin_version='31'\n\n# version_greater_or_equal A B returns whether A >= B\nfunction version_greater_or_equal() {\n\t[[ \"$(printf '%s\\n' \"$@\" | sort -V | head -n 1)\" != \"$1\" || \"$1\" == \"$2\" ]];\n}\n\nfunction create_variant() {\n\tdir=\"$1/$variant\"\n\talpineVersion=${alpine_version[$version]-${alpine_version[default]}}\n\tdebianVersion=${debian_version[$version]-${debian_version[default]}}\n\tftp_options=${ftp_options[$version]-${ftp_options[default]}}\n\tphpVersion=${php_version[$version]-${php_version[default]}}\n\tcrontabInt=${crontab_int[$version]-${crontab_int[default]}}\n\turl=\"https://github.com/nextcloud-releases/server/releases/download/v$fullversion/nextcloud-$fullversion.tar.bz2\"\n\tascUrl=\"https://github.com/nextcloud-releases/server/releases/download/v$fullversion/nextcloud-$fullversion.tar.bz2.asc\"\n\n\t# Create the version+variant directory with a Dockerfile.\n\tmkdir -p \"$dir\"\n\n\ttemplate=\"Dockerfile-${base[$variant]}.template\"\n\techo \"# DO NOT EDIT: created by update.sh from $template\" > \"$dir/Dockerfile\"\n\tcat \"$template\" >> \"$dir/Dockerfile\"\n\n\techo \"updating $fullversion [$1] $variant\"\n\n\t# Replace the variables.\n\tsed -ri -e '\n\t\ts/%%ALPINE_VERSION%%/'\"$alpineVersion\"'/g;\n\t\ts/%%DEBIAN_VERSION%%/'\"$debianVersion\"'/g;\n\t\ts/%%PHP_VERSION%%/'\"$phpVersion\"'/g;\n\t\ts/%%VARIANT%%/'\"$variant\"'/g;\n\t\ts/%%VERSION%%/'\"$fullversion\"'/g;\n\t\ts/%%DOWNLOAD_URL%%/'\"$(sed -e 's/[\\/&]/\\\\&/g' <<< \"$url\")\"'/g;\n\t\ts/%%DOWNLOAD_URL_ASC%%/'\"$(sed -e 's/[\\/&]/\\\\&/g' <<< \"$ascUrl\")\"'/g;\n\t\ts/%%CMD%%/'\"${cmd[$variant]}\"'/g;\n\t\ts|%%VARIANT_EXTRAS%%|'\"${extras[$variant]}\"'|g;\n\t\ts/%%APCU_VERSION%%/'\"${pecl_versions[APCu]}\"'/g;\n\t\ts|%%FTP_OPTIONS%%|'\"$ftp_options\"'|g;\n\t\ts/%%IGBINARY_VERSION%%/'\"${pecl_versions[igbinary]}\"'/g;\n\t\ts/%%IMAGICK_VERSION%%/'\"${pecl_versions[imagick]}\"'/g;\n\t\ts/%%MEMCACHED_VERSION%%/'\"${pecl_versions[memcached]}\"'/g;\n\t\ts/%%REDIS_VERSION%%/'\"${pecl_versions[redis]}\"'/g;\n\t\ts/%%CRONTAB_INT%%/'\"$crontabInt\"'/g;\n\t' \"$dir/Dockerfile\"\n\n\t# Copy the shell scripts\n\tfor name in entrypoint cron; do\n\t\tcp \"docker-$name.sh\" \"$dir/$name.sh\"\n\tdone\n\n\t# Copy the upgrade.exclude\n\tcp upgrade.exclude \"$dir/\"\n\n\t# Copy the config directory\n\tcp -rT .config \"$dir/config\"\n\n\t# Remove Apache config if we're not an Apache variant.\n\tif [ \"$variant\" != \"apache\" ]; then\n\t\trm \"$dir/config/apache-pretty-urls.config.php\"\n\tfi\n\n\t# Add variant to versions.json\n\t[ \"${base[$variant]}\" == \"alpine\" ] && baseVersion=\"$alpineVersion\" || baseVersion=\"$debianVersion\"\n\tversionVariantsJson=\"$(jq -e \\\n\t\t--arg version \"$version\" --arg variant \"$variant\" --arg base \"${base[$variant]}\" --arg baseVersion \"$baseVersion\" --arg phpVersion \"$phpVersion\" \\\n\t\t'.[$version].variants[$variant] = {\"variant\": $variant, \"base\": $base, \"baseVersion\": $baseVersion, \"phpVersion\": $phpVersion}' versions.json)\"\n\tversionJson=\"$(jq -e \\\n\t\t--arg version \"$version\" --arg fullversion \"$fullversion\" --arg url \"$url\" --arg ascUrl \"$ascUrl\" --argjson variants \"$versionVariantsJson\" \\\n\t\t'.[$version] = {\"branch\": $version, \"version\": $fullversion, \"url\": $url, \"ascUrl\": $ascUrl, \"variants\": $variants[$version].variants}' versions.json)\"\n\tprintf '%s\\n' \"$versionJson\" > versions.json\n}\n\ncurl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \\\n\tgrep -oE 'nextcloud-[[:digit:]]+(\\.[[:digit:]]+){2}' | \\\n\tgrep -oE '[[:digit:]]+(\\.[[:digit:]]+){2}' | \\\n\tsort -uV | \\\n\ttail -1 > latest.txt\n\nfind . -maxdepth 1 -type d -regextype sed -regex '\\./[[:digit:]]\\+\\.[[:digit:]]\\+\\(-rc\\|-beta\\|-alpha\\)\\?' -exec rm -r '{}' \\;\n\nprintf '%s' \"{}\" > versions.json\n\nfullversions=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \\\n\tgrep -oE 'nextcloud-[[:digit:]]+(\\.[[:digit:]]+){2}' | \\\n\tgrep -oE '[[:digit:]]+(\\.[[:digit:]]+){2}' | \\\n\tsort -urV ) )\nversions=( $( printf '%s\\n' \"${fullversions[@]}\" | cut -d. -f1 | sort -urV ) )\n\nfor version in \"${versions[@]}\"; do\n\tfullversion=\"$( printf '%s\\n' \"${fullversions[@]}\" | grep -E \"^$version\" | head -1 )\"\n\n\tif version_greater_or_equal \"$version\" \"$min_version\"; then\n\t\tfor variant in \"${variants[@]}\"; do\n\t\t\tcreate_variant \"$version\"\n\t\tdone\n\tfi\ndone\n"
  },
  {
    "path": "upgrade.exclude",
    "content": "/config/\n/data/\n/custom_apps/\n/themes/\n/version.php\n/nextcloud-init-sync.lock\n"
  },
  {
    "path": "versions.json",
    "content": "{\n  \"33\": {\n    \"branch\": \"33\",\n    \"version\": \"33.0.0\",\n    \"url\": \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2\",\n    \"ascUrl\": \"https://github.com/nextcloud-releases/server/releases/download/v33.0.0/nextcloud-33.0.0.tar.bz2.asc\",\n    \"variants\": {\n      \"apache\": {\n        \"variant\": \"apache\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.4\"\n      },\n      \"fpm\": {\n        \"variant\": \"fpm\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.4\"\n      },\n      \"fpm-alpine\": {\n        \"variant\": \"fpm-alpine\",\n        \"base\": \"alpine\",\n        \"baseVersion\": \"3.23\",\n        \"phpVersion\": \"8.4\"\n      }\n    }\n  },\n  \"32\": {\n    \"branch\": \"32\",\n    \"version\": \"32.0.6\",\n    \"url\": \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2\",\n    \"ascUrl\": \"https://github.com/nextcloud-releases/server/releases/download/v32.0.6/nextcloud-32.0.6.tar.bz2.asc\",\n    \"variants\": {\n      \"apache\": {\n        \"variant\": \"apache\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.3\"\n      },\n      \"fpm\": {\n        \"variant\": \"fpm\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.3\"\n      },\n      \"fpm-alpine\": {\n        \"variant\": \"fpm-alpine\",\n        \"base\": \"alpine\",\n        \"baseVersion\": \"3.23\",\n        \"phpVersion\": \"8.3\"\n      }\n    }\n  },\n  \"31\": {\n    \"branch\": \"31\",\n    \"version\": \"31.0.14\",\n    \"url\": \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2\",\n    \"ascUrl\": \"https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.tar.bz2.asc\",\n    \"variants\": {\n      \"apache\": {\n        \"variant\": \"apache\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.3\"\n      },\n      \"fpm\": {\n        \"variant\": \"fpm\",\n        \"base\": \"debian\",\n        \"baseVersion\": \"trixie\",\n        \"phpVersion\": \"8.3\"\n      },\n      \"fpm-alpine\": {\n        \"variant\": \"fpm-alpine\",\n        \"base\": \"alpine\",\n        \"baseVersion\": \"3.23\",\n        \"phpVersion\": \"8.3\"\n      }\n    }\n  }\n}\n"
  }
]