Give staging its own address rather than a spare room in the main house
A subdomain means a separate origin, so a staging run can no longer overwrite the localStorage the testteam is playing on. That makes the /staging alias pointless, so the Dockerfile goes back to exactly what is deployed today. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
708ed9c57f
commit
4f49a0b4e1
2 files changed
+8
-14
No files matched your search
+4
-9
@@ -1,14 +1,9 @@
|
||||
FROM nginx:alpine
|
||||
# no-cache => browsers revalidate every request (ETag 304s are cheap), so a new
|
||||
# deploy is picked up on plain reload. ponytail: switch to hashed filenames if traffic ever matters.
|
||||
# nginx's default map has no .webmanifest entry and Chrome refuses to install a homescreen app
|
||||
# served as octet-stream, so we append the type to the stock map. It has to be the map and not a
|
||||
# `location`: an exact match misses the /staging/ copy below, and a regex match would out-rank the
|
||||
# /staging/ prefix and resolve against root instead of the alias. A local `types {}` block is out
|
||||
# too — it REPLACES the whole map (breaking .js/.png), and mime.types can't be re-included inside one.
|
||||
RUN sed -i 's#^}# application/manifest+json webmanifest;\n}#' /etc/nginx/mime.types
|
||||
# The /staging/ alias serves the SAME files one level down, so the staging deploy works whether or
|
||||
# not Coolify/Traefik strips the path prefix. Identical on every branch => never a merge conflict.
|
||||
RUN printf 'server {\n listen 80;\n root /usr/share/nginx/html;\n etag on;\n index index.html;\n absolute_redirect off;\n location = /staging { return 301 /staging/; }\n location /staging/ { alias /usr/share/nginx/html/; add_header Cache-Control "no-cache, must-revalidate"; }\n location / { add_header Cache-Control "no-cache, must-revalidate"; }\n}\n' > /etc/nginx/conf.d/default.conf
|
||||
# The exact-match location gives the manifest its own MIME type — nginx's default map has no
|
||||
# .webmanifest entry and Chrome refuses to install a homescreen app served as octet-stream.
|
||||
# (a bare `types {}` block would have REPLACED the whole map and broken .js/.png too.)
|
||||
RUN printf 'server {\n listen 80;\n root /usr/share/nginx/html;\n etag on;\n location = /manifest.webmanifest { default_type application/manifest+json; add_header Cache-Control "no-cache, must-revalidate"; }\n location / { add_header Cache-Control "no-cache, must-revalidate"; }\n}\n' > /etc/nginx/conf.d/default.conf
|
||||
COPY index.html manifest.webmanifest *.js /usr/share/nginx/html/
|
||||
COPY assets /usr/share/nginx/html/assets
|
||||
Reference in new issue
Block a user