chore: add redeploy script
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Rebuild + redeploy a SINGLE compose service without touching the rest of the
|
||||||
|
# stack. The whole-stack rebuild you keep hitting happens because `web-app`
|
||||||
|
# depends_on slmm + sfm, so `compose up --build web-app` rebuilds the entire
|
||||||
|
# dependency tree. `--no-deps` is the fix: build + recreate ONLY this service.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./redeploy.sh # rebuild + redeploy web-app (prod-style, :8001)
|
||||||
|
# ./redeploy.sh terra-view # the dev container (:1001, bind-mounted source)
|
||||||
|
# ./redeploy.sh sfm # any single service
|
||||||
|
#
|
||||||
|
# Tip: the dev `terra-view` service bind-mounts the source, so for plain
|
||||||
|
# code/template edits you usually only need: docker compose restart terra-view
|
||||||
|
# Rebuild it only when requirements.txt or the Dockerfile changed.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
SVC="${1:-web-app}"
|
||||||
|
|
||||||
|
if ! docker compose config --services | grep -qx "$SVC"; then
|
||||||
|
echo "✗ '$SVC' is not a service in this compose project."
|
||||||
|
echo " Available: $(docker compose config --services | paste -sd' ')"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "▶ Rebuilding '$SVC' (dependencies untouched)…"
|
||||||
|
docker compose build "$SVC"
|
||||||
|
|
||||||
|
echo "▶ Recreating ONLY '$SVC'…"
|
||||||
|
docker compose up -d --no-deps "$SVC"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "✓ '$SVC' redeployed. Current state:"
|
||||||
|
docker compose ps "$SVC"
|
||||||
Reference in New Issue
Block a user