This commit is contained in:
+6
-6
@@ -15,12 +15,12 @@ steps:
|
|||||||
test -n "$CONTAINER_ID" || { echo "No running portfolio container found on port 8091"; exit 1; }
|
test -n "$CONTAINER_ID" || { echo "No running portfolio container found on port 8091"; exit 1; }
|
||||||
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"
|
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"
|
||||||
test -n "$HOST_SITE" || { echo "Portfolio container has no /usr/share/nginx/html bind mount"; exit 1; }
|
test -n "$HOST_SITE" || { echo "Portfolio container has no /usr/share/nginx/html bind mount"; exit 1; }
|
||||||
case "$HOST_SITE" in
|
SITE_INDEX="$(grep -rl -m1 --include='index.html' 'Keith Casko' /host-lab 2>/dev/null | head -n 1)"
|
||||||
/root/lab/*) TARGET="/host-lab/${HOST_SITE#/root/lab/}" ;;
|
test -n "$SITE_INDEX" || { echo "Could not locate casko.dev index.html under /root/lab"; exit 1; }
|
||||||
*) echo "Unexpected portfolio site path: $HOST_SITE"; exit 1 ;;
|
TARGET="$(dirname "$SITE_INDEX")"
|
||||||
esac
|
echo "Portfolio container: $CONTAINER_ID"
|
||||||
test -f "$TARGET/index.html" || { echo "Target index.html not found: $TARGET"; exit 1; }
|
echo "Reported host mount: $HOST_SITE"
|
||||||
grep -q "Keith Casko" "$TARGET/index.html" || { echo "Target does not look like casko.dev portfolio"; exit 1; }
|
echo "Resolved live site: $TARGET"
|
||||||
cp -a index.html homelab.html css js assets "$TARGET/"
|
cp -a index.html homelab.html css js assets "$TARGET/"
|
||||||
docker restart "$CONTAINER_ID"
|
docker restart "$CONTAINER_ID"
|
||||||
echo "Deployed commit $CI_COMMIT_SHA to $HOST_SITE"
|
echo "Deployed commit $CI_COMMIT_SHA to $HOST_SITE"
|
||||||
|
|||||||
Reference in New Issue
Block a user