# DO NOT EDIT: created by update.sh from Dockerfile-unit.template FROM eumau/nginx-unit:1.12.0-php7.3 # entrypoint.sh and cron.sh dependencies RUN set -ex; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ busybox-static \ ; \ rm -rf /var/lib/apt/lists/*; \ \ mkdir -p /var/spool/cron/crontabs; \ echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data # install the PHP extensions we need # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html RUN set -ex; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ php-exif \ php-gd \ php-intl \ php-ldap \ php-opcache \ php-mysql \ php-pgsql \ php-sqlite3 \ php-zip \ php-apcu \ php-memcached \ php-redis \ php-imagick \ php-xml \ php-mbstring \ php-curl \ ; \ \ rm -rf /var/lib/apt/lists/* # set recommended PHP.ini settings # see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html#enable-php-opcache RUN { \ echo 'opcache.enable=1'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.save_comments=1'; \ echo 'opcache.revalidate_freq=1'; \ } > /etc/php/7.3/embed/conf.d/opcache-recommended.ini; \ \ echo 'apc.enable_cli=1' >> /etc/php/7.3/embed/conf.d/docker-php-ext-apcu.ini; \ \ echo 'memory_limit=512M' > /etc/php/7.3/embed/conf.d/memory-limit.ini; \ \ mkdir -p /var/www/data; \ chown -R www-data:root /var/www; \ chmod -R g=u /var/www VOLUME /var/www/html ENV NEXTCLOUD_VERSION 17.0.0 RUN set -ex; \ fetchDeps=" \ gnupg \ dirmngr \ "; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ \ curl -fsSL -o nextcloud.tar.bz2 \ "https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2.asc \ "https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \ export GNUPGHOME="$(mktemp -d)"; \ # gpg key from https://nextcloud.com/nextcloud.asc gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \ tar -xjf nextcloud.tar.bz2 -C /usr/src/; \ gpgconf --kill all; \ rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc nextcloud.tar.bz2; \ rm -rf /usr/src/nextcloud/updater; \ mkdir -p /usr/src/nextcloud/data; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \ rm -rf /var/lib/apt/lists/* COPY *.sh upgrade.exclude / COPY config/* /usr/src/nextcloud/config/ # launch and configure Unit RUN \ [ -f /var/www/html/index.php ] || { \ touch /var/www/html/index.php /var/www/html/index.php.remove; \ } \ && unitd --control unix:/var/run/control.unit.sock \ && curl -X PUT --data-binary \ '{ \ "listeners": { "*:9000": { "pass": "routes/main" } }, \ "listeners": { "*:9001": { "pass": "routes/dynamic" } }, \ "listeners": { "*:9002": { "pass": "routes/static" } }, \ "routes": { \ "main": [ \ { "match": { "uri": "/console.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/cron.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/index.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/public.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/remote.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/status.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/version.php" }, "action": { "pass": "applications/direct_php" } }, \ { "match": { "uri": "/core/img/*" }, "action": { "share": "/var/www/html" } }, \ { "match": { "uri": "/core/css/*" }, "action": { "share": "/var/www/html" } }, \ { "match": { "uri": "/core/fonts/*" }, "action": { "share": "/var/www/html" } }, \ { "match": { "uri": "/core/js/*" }, "action": { "share": "/var/www/html" } }, \ { "match": { "uri": "/themes/*" }, "action": { "share": "/var/www/html" } }, \ { "action": { "pass": "applications/index_php" } } \ ], \ "static": [ \ { "action": { "share": "/var/www/html" } } \ ], \ "dynamic": [ \ { "action": { "pass": "applications/index_php" } } \ ], \ }, \ "applications": { \ "index_php": { \ "type": "php", \ "processes": { "max": 20, "spare": 5 }, \ "user": "www-data", \ "group": "www-data", \ "root": "/var/www/html", \ "script": "index.php" \ }, \ "direct_php": { \ "type": "php", \ "processes": { "max": 5, "spare": 0 }, \ "user": "www-data", \ "group": "www-data", \ "root": "/var/www/html", \ "index": "index.php" \ } \ } \ }' \ --unix-socket /var/run/control.unit.sock http://localhost/config/ \ && [ -f /var/www/html/index.php.remove ] && { \ rm /var/www/html/index.php /var/www/html/index.php.remove; \ } EXPOSE 9000 9001 9002 ENTRYPOINT ["/entrypoint.sh"] STOPSIGNAL SIGTERM CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]