Skip to content

Commit 4fe1000

Browse files
committed
feat: Improve WASM deployment by preventing caching, pinning Emscripten SDK, and enabling minimal downtime updates.
1 parent 012404b commit 4fe1000

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

deploy/wasm/Caddyfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
# Serve QtThermalFIST.html as index
99
try_files {path} /QtThermalFIST.html
1010

11+
# Prevent browser from caching stale WASM builds
12+
@wasm_assets path *.js *.wasm
13+
header @wasm_assets Cache-Control "no-cache, must-revalidate"
14+
1115
# Enable compression
1216
encode gzip
1317
}

deploy/wasm/Dockerfile.base

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ RUN apt-get update && apt-get install -y \
2222
# Install aqtinstall for downloading Qt
2323
RUN pip3 install aqtinstall
2424

25-
# Install Emscripten 4.0.7
25+
# Install Emscripten 4.0.7 (pin emsdk to the 4.0.7 release tag for reproducibility)
2626
WORKDIR /opt
27-
RUN git clone https://github.com/emscripten-core/emsdk.git
27+
RUN git clone --depth 1 -b 4.0.7 https://github.com/emscripten-core/emsdk.git
2828
WORKDIR /opt/emsdk
2929
RUN ./emsdk install 4.0.7 && \
3030
./emsdk activate 4.0.7

deploy/wasm/update_docker.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ if ! docker image inspect thermal-fist-wasm-base >/dev/null 2>&1; then
2323
fi
2424

2525
echo "=== Building Thermal-FIST WASM ==="
26-
docker compose down
26+
# Build new image while old container keeps serving traffic
2727
docker compose build --build-arg CACHEBUST=$(date +%s)
28+
# Recreate container with new image (only seconds of downtime)
2829
docker compose up -d
2930
echo ""
3031
echo "=== Done ==="

0 commit comments

Comments
 (0)