- build.sh: Remove old bundle tag before injecting hashed version - index.html: Remove duplicate script tag from template - docker-compose.yml: Fix network name (hermes-net, not litellm_hermes-net) - Deployment verified: HTTPS 200 via Cloudflare + Traefik
26 lines
825 B
Bash
Executable File
26 lines
825 B
Bash
Executable File
#!/bin/bash
|
|
# Build script: webpack + content-hashed filename for permanent cache-busting
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
|
|
# Build webpack
|
|
npx webpack --mode production
|
|
|
|
# Generate content hash for bundle.js
|
|
BUNDLE_HASH=$(md5sum dist/bundle.js | cut -c1-8)
|
|
BUNDLE_FILE="bundle.${BUNDLE_HASH}.js"
|
|
mv dist/bundle.js "dist/${BUNDLE_FILE}"
|
|
|
|
BUILD_TS=$(date +%s)
|
|
|
|
# Rewrite HTML: remove old bundle.js script tag, inject only content-hashed filename
|
|
# and inject timestamp for diagnostic script
|
|
sed -i "/bundle\.js?v=BUILD_TIMESTAMP/d" dist/index.html
|
|
sed -i "s|</head>|<script defer src=\"${BUNDLE_FILE}\"></script></head>|g" dist/index.html
|
|
sed -i "s/BUILD_TIMESTAMP/${BUILD_TS}/g" dist/index.html
|
|
|
|
# Copy assets that webpack ignores
|
|
cp tundra_background.png dist/
|
|
|
|
echo "[build] done — bundle: ${BUNDLE_FILE} (build ${BUILD_TS})"
|