precompress static files

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey
2026-08-08 22:36:39 +02:00
parent da782248f1
commit 26ec46a6a7
4 changed files with 27 additions and 0 deletions
+22
View File
@@ -17,6 +17,28 @@ Listen 8000
<Proxy "fcgi://${NEXTCLOUD_HOST}:9000" flushpackets=on>
</Proxy>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.br -s
RewriteRule ^ %{REQUEST_URI}.br [END]
</IfModule>
<IfModule mod_mime.c>
AddEncoding br .br
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(css|js|mjs|svg|ico)\.br$">
<If "%{QUERY_STRING} =~ /(^|&)v=/">
Header set Cache-Control "max-age=15778463, immutable"
</If>
<Else>
Header set Cache-Control "max-age=15778463"
</Else>
</FilesMatch>
</IfModule>
# Nextcloud dir
DocumentRoot /var/www/html/
<Directory /var/www/html/>
+3
View File
@@ -228,6 +228,7 @@ RUN set -ex; \
\
apk add --no-cache \
bash \
brotli \
netcat-openbsd \
openssl \
gnupg \
@@ -269,6 +270,8 @@ RUN set -ex; \
\
echo "[ -n \"\$TERM\" ] && [ -f /root.motd ] && cat /root.motd" >> /root/.bashrc; \
\
find /usr/src/nextcloud/apps /usr/src/nextcloud/core /usr/src/nextcloud/dist \( -name "*.js" -o -name "*.mjs" -o -name "*.css" -o -name "*.html" -o -name "*.svg" -o -name "*.ico" \) -type f -print0 | xargs -r0 -P "$(nproc)" -n 1 brotli -q 11; \
\
chown www-data:root -R /usr/src && \
chmod 777 -R /usr/local/etc/php/conf.d && \
chmod 777 -R /usr/local/etc/php-fpm.d && \
+1
View File
@@ -223,6 +223,7 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
mv /usr/src/tmp/nextcloud "$SOURCE_LOCATION"
rm -r /usr/src/tmp
rm -r /usr/src/temp-nextcloud
find "$SOURCE_LOCATION/apps" "$SOURCE_LOCATION/core" "$SOURCE_LOCATION/dist" \( -name "*.js" -o -name "*.mjs" -o -name "*.css" -o -name "*.html" -o -name "*.svg" -o -name "*.ico" \) -type f -print0 | xargs -r0 -P "$(nproc)" -n 1 brotli -q 11;
# shellcheck disable=SC2016
image_version="$(php -r "require '$SOURCE_LOCATION/version.php'; echo implode('.', \$OC_Version);")"
IMAGE_MAJOR="${image_version%%.*}"
@@ -36,6 +36,7 @@ if ! $PHP_CLI -r "version_compare(getenv('INSTALLED_MAJOR'), getenv('IMAGE_MAJOR
exit 1
fi
fi
find /var/www/html/apps /var/www/html/core /var/www/html/dist \( -name "*.js" -o -name "*.mjs" -o -name "*.css" -o -name "*.html" -o -name "*.svg" -o -name "*.ico" \) -type f -print0 | xargs -r0 -P "$(nproc)" -n 1 brotli -q 11;
$PHP_CLI /var/www/html/occ config:system:set updatechecker --type=bool --value=true
$PHP_CLI /var/www/html/occ app:enable nextcloud-aio --force
$PHP_CLI /var/www/html/occ db:add-missing-columns