Files
iron-requiem/build.sh
Kay Kayyali 4bef8e66df
Some checks failed
Iron Requiem CI/CD / test (push) Failing after 11s
Iron Requiem CI/CD / deploy (push) Has been skipped
Build & Deploy / build-and-deploy (push) Has been cancelled
Fix Recovery Phase 4: Single bundle script, correct Traefik network
- 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
2026-05-24 04:30:06 +00:00

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})"