static: remove old container last (zero-downtime cutover)

This commit is contained in:
ops 2026-06-02 00:06:23 +00:00
parent d549c2405f
commit a549aee2f1

View file

@ -137,7 +137,6 @@ runs:
case "$DT" in case "$DT" in
static) static)
docker rm -f "$SLUG" >/dev/null 2>&1 || true # in case it was previously a container deploy
echo "::group::build (bun)" echo "::group::build (bun)"
BH="build-${SLUG}-${SHA}" BH="build-${SLUG}-${SHA}"
docker rm -f "$BH" >/dev/null 2>&1 || true docker rm -f "$BH" >/dev/null 2>&1 || true
@ -163,6 +162,10 @@ runs:
echo "::endgroup::" echo "::endgroup::"
write_fragment "$(printf '%s {\n\troot * /srv/sites/%s\n\tfile_server\n\ttry_files {path} /index.html\n}\n' "$SITE_ADDR" "$DOMAIN")" write_fragment "$(printf '%s {\n\troot * /srv/sites/%s\n\tfile_server\n\ttry_files {path} /index.html\n}\n' "$SITE_ADDR" "$DOMAIN")"
# Remove any prior container LAST — zero-downtime: a pre-existing
# container kept serving the domain (via its old fragment) all through
# the build above, until the file_server fragment took over just now.
docker rm -f "$SLUG" >/dev/null 2>&1 && echo " removed old container (switched to static)" || true
;; ;;
docker|docker-db) docker|docker-db)