Service worker fix
This commit is contained in:
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
## Fetch content, build the image, clear the cache and restart the container
|
## Fetch content, build the image, clear the cache and restart the container
|
||||||
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run fetch-content
|
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run fetch-content
|
||||||
docker build \
|
docker compose --env-file ../site/.env -f ../docker-compose.yml build
|
||||||
--build-arg PUBLIC_ENABLE_SW=$(grep PUBLIC_ENABLE_SW ./site/.env | cut -d '=' -f2) \
|
|
||||||
--build-arg PUBLIC_SITE_URL=$(grep PUBLIC_SITE_URL ./site/.env | cut -d '=' -f2) \
|
|
||||||
--build-arg PUBLIC_UMAMI_SCRIPT_URL=$(grep PUBLIC_UMAMI_SCRIPT_URL ./site/.env | cut -d '=' -f2) \
|
|
||||||
--build-arg PUBLIC_UMAMI_WEBSITE_ID=$(grep PUBLIC_UMAMI_WEBSITE_ID ./site/.env | cut -d '=' -f2) \
|
|
||||||
-t fast-website:local .
|
|
||||||
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run cache:clear
|
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run cache:clear
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
@@ -61,7 +61,6 @@ const canonicalUrl = `${siteUrl}${canonicalPath.startsWith("/") ? canonicalPath
|
|||||||
// and only when explicitly enabled by env.
|
// and only when explicitly enabled by env.
|
||||||
import.meta.env.PROD && import.meta.env.PUBLIC_ENABLE_SW === "true" ? (
|
import.meta.env.PROD && import.meta.env.PUBLIC_ENABLE_SW === "true" ? (
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
{`
|
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
// SW requires HTTPS (or localhost). In prod we expect HTTPS.
|
// SW requires HTTPS (or localhost). In prod we expect HTTPS.
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
@@ -70,8 +69,8 @@ const canonicalUrl = `${siteUrl}${canonicalPath.startsWith("/") ? canonicalPath
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
`}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user