Use serve for removing index.html caching

This commit is contained in:
Nabarun 2025-05-02 10:17:37 +05:30
parent b2eafe59b3
commit 8c7561050c
4 changed files with 28 additions and 2 deletions

View File

@ -14,6 +14,7 @@ services:
command: ["bash", "/scripts/run.sh"]
volumes:
- ../config/app/run.sh:/scripts/run.sh
- ../config/app/serve.json:/app/serve.json
ports:
- "80"
healthcheck:

View File

@ -28,5 +28,8 @@ mkdir -p "$(dirname "$FILE_PATH")"
# Write verification code to the file
echo "$WALLET_CONNECT_VERIFY_CODE" > "$FILE_PATH"
# Copy over serve config to build
cp /app/serve/serve.json /app/build/serve.json
# Serve build dir
http-server --proxy http://localhost:80? -p 80 /app/build
serve -s -l 80 /app/build

View File

@ -0,0 +1,22 @@
{
"headers": [
{
"source": "/index.html",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, must-revalidate"
}
]
},
{
"source": "/static/(.*)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
}
]
}

View File

@ -33,7 +33,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN mkdir -p /scripts
# Install simple web server for now (use nginx perhaps later)
RUN yarn global add http-server
RUN yarn global add serve
WORKDIR /app
COPY . .