mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-21 00:28:08 +08:00
Precompress assets and set the right cache headers
This commit is contained in:
parent
50934a53cd
commit
f022eb09a2
@ -2,9 +2,3 @@ FROM nginxinc/nginx-unprivileged:alpine
|
|||||||
|
|
||||||
COPY ./dist /app
|
COPY ./dist /app
|
||||||
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN rm -rf /usr/share/nginx/html
|
|
||||||
|
|
||||||
USER 101
|
|
||||||
|
@ -3,23 +3,16 @@ server {
|
|||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /app;
|
root /app;
|
||||||
|
gzip_static on;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# disable cache entriely by default (apart from Etag which is accurate enough)
|
|
||||||
add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
|
||||||
if_modified_since off;
|
|
||||||
expires off;
|
|
||||||
# also turn off last-modified since they are just the timestamps of the file in the docker image
|
|
||||||
# and may or may not bear any resemblance to when the resource changed
|
|
||||||
add_header Last-Modified "";
|
|
||||||
|
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||||
}
|
}
|
||||||
|
|
||||||
# assets can be cached because they have hashed filenames
|
# assets can be cached because they have hashed filenames
|
||||||
location /assets {
|
location /assets {
|
||||||
expires 1w;
|
add_header Cache-Control "public, immutable, max-age=31536000";
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location /apple-app-site-association {
|
location /apple-app-site-association {
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
"unique-names-generator": "^4.6.0",
|
"unique-names-generator": "^4.6.0",
|
||||||
"vaul": "^1.0.0",
|
"vaul": "^1.0.0",
|
||||||
"vite": "^5.0.0",
|
"vite": "^5.0.0",
|
||||||
|
"vite-plugin-compression2": "^1.3.1",
|
||||||
"vite-plugin-html-template": "^1.1.0",
|
"vite-plugin-html-template": "^1.1.0",
|
||||||
"vite-plugin-svgr": "^4.0.0",
|
"vite-plugin-svgr": "^4.0.0",
|
||||||
"vitest": "^2.0.0",
|
"vitest": "^2.0.0",
|
||||||
|
@ -6,6 +6,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineConfig, loadEnv } from "vite";
|
import { defineConfig, loadEnv } from "vite";
|
||||||
|
import { compression } from "vite-plugin-compression2";
|
||||||
import svgrPlugin from "vite-plugin-svgr";
|
import svgrPlugin from "vite-plugin-svgr";
|
||||||
import htmlTemplate from "vite-plugin-html-template";
|
import htmlTemplate from "vite-plugin-html-template";
|
||||||
import { codecovVitePlugin } from "@codecov/vite-plugin";
|
import { codecovVitePlugin } from "@codecov/vite-plugin";
|
||||||
@ -38,6 +39,10 @@ export default defineConfig(({ mode }) => {
|
|||||||
bundleName: "element-call",
|
bundleName: "element-call",
|
||||||
uploadToken: process.env.CODECOV_TOKEN,
|
uploadToken: process.env.CODECOV_TOKEN,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
compression({
|
||||||
|
exclude: [/config.json/],
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
19
yarn.lock
19
yarn.lock
@ -2542,7 +2542,7 @@
|
|||||||
"@react-spring/shared" "~9.7.5"
|
"@react-spring/shared" "~9.7.5"
|
||||||
"@react-spring/types" "~9.7.5"
|
"@react-spring/types" "~9.7.5"
|
||||||
|
|
||||||
"@rollup/pluginutils@^5.1.3":
|
"@rollup/pluginutils@^5.1.0", "@rollup/pluginutils@^5.1.3":
|
||||||
version "5.1.3"
|
version "5.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.3.tgz#3001bf1a03f3ad24457591f2c259c8e514e0dbdf"
|
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.3.tgz#3001bf1a03f3ad24457591f2c259c8e514e0dbdf"
|
||||||
integrity sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==
|
integrity sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==
|
||||||
@ -7927,6 +7927,11 @@ tapable@^2.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
|
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
|
||||||
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
|
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
|
||||||
|
|
||||||
|
tar-mini@^0.2.0:
|
||||||
|
version "0.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/tar-mini/-/tar-mini-0.2.0.tgz#2b2cdc215f5b83b0ab8ce363dc9ded22de51849b"
|
||||||
|
integrity sha512-+qfUHz700DWnRutdUsxRRVZ38G1Qr27OetwaMYTdg8hcPxf46U0S1Zf76dQMWRBmusOt2ZCK5kbIaiLkoGO7WQ==
|
||||||
|
|
||||||
teex@^1.0.1:
|
teex@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12"
|
resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12"
|
||||||
@ -8430,6 +8435,16 @@ vite-node@2.1.4:
|
|||||||
pathe "^1.1.2"
|
pathe "^1.1.2"
|
||||||
vite "^5.0.0"
|
vite "^5.0.0"
|
||||||
|
|
||||||
|
vite-plugin-compression2@^1.3.1:
|
||||||
|
version "1.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/vite-plugin-compression2/-/vite-plugin-compression2-1.3.1.tgz#ac2a512f8ca90a76687add6cf441000dd2c41485"
|
||||||
|
integrity sha512-UMr66CFu+RVPiD8E3iaX9BdZjCgO+lzzaAPAZvL5YgwH6FU4OR/MulJEyp9wq9EKoO6ErjUtPpaiDi3hvzv79Q==
|
||||||
|
dependencies:
|
||||||
|
"@rollup/pluginutils" "^5.1.0"
|
||||||
|
tar-mini "^0.2.0"
|
||||||
|
optionalDependencies:
|
||||||
|
vite "^5.3.4"
|
||||||
|
|
||||||
vite-plugin-html-template@^1.1.0:
|
vite-plugin-html-template@^1.1.0:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/vite-plugin-html-template/-/vite-plugin-html-template-1.2.2.tgz#d263c18dcf5f5e54bc74894546fd0ed993191f2f"
|
resolved "https://registry.yarnpkg.com/vite-plugin-html-template/-/vite-plugin-html-template-1.2.2.tgz#d263c18dcf5f5e54bc74894546fd0ed993191f2f"
|
||||||
@ -8446,7 +8461,7 @@ vite-plugin-svgr@^4.0.0:
|
|||||||
"@svgr/core" "^8.1.0"
|
"@svgr/core" "^8.1.0"
|
||||||
"@svgr/plugin-jsx" "^8.1.0"
|
"@svgr/plugin-jsx" "^8.1.0"
|
||||||
|
|
||||||
vite@^5.0.0:
|
vite@^5.0.0, vite@^5.3.4:
|
||||||
version "5.4.11"
|
version "5.4.11"
|
||||||
resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.11.tgz#3b415cd4aed781a356c1de5a9ebafb837715f6e5"
|
resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.11.tgz#3b415cd4aed781a356c1de5a9ebafb837715f6e5"
|
||||||
integrity sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==
|
integrity sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==
|
||||||
|
Loading…
Reference in New Issue
Block a user