Serve the wasm and scripts gzip-compressed (packed at build time)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c52fc4c4ae
commit
beb53a2e0c
2 files changed
+9
No files matched your search
@@ -31,4 +31,6 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY www/ /usr/share/nginx/html/
|
||||
COPY --from=build /out/ /usr/share/nginx/html/
|
||||
COPY --from=standalone /out/standalone/ /usr/share/nginx/html/standalone/
|
||||
# packed once for gzip_static (nginx.conf)
|
||||
RUN cd /usr/share/nginx/html && gzip -k -9 dungeoncraft.wasm mq_js_bundle.js standalone/DungeonCraft.html
|
||||
EXPOSE 80
|
||||
@@ -4,6 +4,13 @@ server {
|
||||
index index.html;
|
||||
# test build: always reload fresh files
|
||||
add_header Cache-Control "no-cache";
|
||||
# compressed downloads: the big files are packed once at build time (*.gz, see Dockerfile),
|
||||
# the rest on the fly (the wasm goes from about 8.8 MB to 2.6 MB)
|
||||
gzip_static on;
|
||||
gzip on;
|
||||
gzip_types application/wasm application/javascript text/css application/json application/manifest+json image/svg+xml;
|
||||
gzip_min_length 1024;
|
||||
gzip_vary on;
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user