@@ -319,26 +319,43 @@ copy_tree_via_staged_tar() {
319319 echo " rebuild_frontend.sh: extracting staged tar into web:${dest} ..."
320320 docker compose exec -T web bash -lc \
321321 " rm -rf '${dest} ' && mkdir -p '${dest} ' && tar -xf '${container_tar} ' -C '${dest} ' && rm -f '${container_tar} '"
322+ verify_container_extract_fingerprint " ${dest} " " ${dest} "
322323}
323324
324- run_collectstatic_into_volume () {
325- echo " rebuild_frontend.sh: running collectstatic into ${CONTAINER_STATIC_ROOT_FRONTEND} ..."
326- docker compose exec -T web bash -lc \
327- " rm -rf '${CONTAINER_STATIC_ROOT_FRONTEND} ' && /usr/local/bin/python3 hpcperfstats/site/manage.py collectstatic --noinput"
325+ verify_container_extract_fingerprint () {
326+ local dest=" $1 "
327+ local label=" $2 "
328+ local host_fp container_fp probe=" ${dest} /machine/index.html"
329+
330+ host_fp=" $( frontend_build_fingerprint " ${STATIC_FRONTEND} /machine/index.html" ) "
331+ container_fp=" $(
332+ docker compose exec -T web bash -lc \
333+ " grep -oE 'page-[0-9a-f]+\\ .js' '${probe} ' 2>/dev/null | head -n 1 || echo unknown"
334+ ) "
335+
336+ if [[ " ${host_fp} " != " ${container_fp} " ]]; then
337+ echo " rebuild_frontend.sh: ${label} fingerprint mismatch after extract" >&2
338+ echo " host: ${host_fp} (${STATIC_FRONTEND} /machine/index.html)" >&2
339+ echo " container: ${container_fp} (${probe} )" >&2
340+ return 1
341+ fi
342+
343+ echo " Verified extract fingerprint for ${label} (${container_fp} )"
328344}
329345
330- deploy_frontend_via_collectstatic () {
331- echo " rebuild_frontend.sh: podman-compose deploy — stage image source tree, then collectstatic to nginx volume"
346+ deploy_frontend_via_staged_volume () {
347+ echo " rebuild_frontend.sh: podman-compose — staged tar direct to nginx volume (staticfiles_data)"
348+ copy_tree_via_staged_tar " ${CONTAINER_STATIC_ROOT_FRONTEND} "
349+ echo " rebuild_frontend.sh: syncing image source tree for future image rebuilds ..."
332350 copy_tree_via_staged_tar " ${CONTAINER_STATIC_FRONTEND} "
333- run_collectstatic_into_volume
334351}
335352
336353print_podman_deploy_fallback () {
337354 cat << EOF >&2
338355rebuild_frontend.sh: manual podman fallback (from git checkout):
339356 tar -cf /tmp/hps-frontend.tar -C hpcperfstats/site/hpcperfstats_site/static/frontend .
340357 podman cp /tmp/hps-frontend.tar hpcperfstats_web_1:/tmp/hps-frontend.tar
341- docker compose exec web bash -lc 'rm -rf ${CONTAINER_STATIC_FRONTEND } && mkdir -p ${CONTAINER_STATIC_FRONTEND } && tar -xf /tmp/hps-frontend.tar -C ${CONTAINER_STATIC_FRONTEND } && rm -f /tmp/hps-frontend.tar && rm -rf ${CONTAINER_STATIC_ROOT_FRONTEND} && /usr/local/bin/python3 hpcperfstats/site/manage.py collectstatic --noinput '
358+ docker compose exec web bash -lc 'rm -rf ${CONTAINER_STATIC_ROOT_FRONTEND } && mkdir -p ${CONTAINER_STATIC_ROOT_FRONTEND } && tar -xf /tmp/hps-frontend.tar -C ${CONTAINER_STATIC_ROOT_FRONTEND } && rm -f /tmp/hps-frontend.tar'
342359EOF
343360}
344361
@@ -362,8 +379,7 @@ copy_tree_into_container() {
362379 exit 1
363380 fi
364381
365- # podman-compose: stdin tar / compose cp / direct volume copy are unreliable; stage the
366- # image source tree and refresh STATIC_ROOT/frontend with collectstatic (same as startup).
382+ # podman-compose: stage tar, extract with compose exec onto the destination path.
367383 echo " rebuild_frontend.sh: copying via staged tar + compose exec extract → ${dest} "
368384 copy_tree_via_staged_tar " ${dest} "
369385}
@@ -372,7 +388,7 @@ copy_frontend_into_web() {
372388 cd " ${REPO_ROOT} "
373389
374390 if compose_backend_is_podman; then
375- deploy_frontend_via_collectstatic
391+ deploy_frontend_via_staged_volume
376392 return
377393 fi
378394
0 commit comments