This commit is contained in:
+5
-7
@@ -12,11 +12,9 @@ steps:
|
|||||||
set -eu
|
set -eu
|
||||||
CONTAINER_ID="$(docker ps --filter publish=8091 --format '{{.ID}}' | head -n 1)"
|
CONTAINER_ID="$(docker ps --filter publish=8091 --format '{{.ID}}' | head -n 1)"
|
||||||
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; }
|
||||||
docker exec "$CONTAINER_ID" sh -c "grep -q 'Keith Casko' /usr/share/nginx/html/index.html" || { echo "Port 8091 container does not look like casko.dev"; exit 1; }
|
HOST_SITE="$(docker inspect "$CONTAINER_ID" --format '{{range .Mounts}}{{if eq .Destination "/usr/share/nginx/html"}}{{.Source}}{{end}}{{end}}')"
|
||||||
docker cp index.html "$CONTAINER_ID":/usr/share/nginx/html/index.html
|
test -n "$HOST_SITE" || { echo "Could not resolve portfolio host webroot"; exit 1; }
|
||||||
docker cp homelab.html "$CONTAINER_ID":/usr/share/nginx/html/homelab.html
|
docker run --rm -v "$HOST_SITE":/target:ro alpine:3.20 sh -c "grep -q 'Keith Casko' /target/index.html" || { echo "Resolved host path does not look like casko.dev"; exit 1; }
|
||||||
docker cp css "$CONTAINER_ID":/usr/share/nginx/html/
|
tar -cf - index.html homelab.html css js assets | docker run --rm -i -v "$HOST_SITE":/target alpine:3.20 sh -c 'cd /target && tar xf -'
|
||||||
docker cp js "$CONTAINER_ID":/usr/share/nginx/html/
|
|
||||||
docker cp assets "$CONTAINER_ID":/usr/share/nginx/html/
|
|
||||||
docker restart "$CONTAINER_ID"
|
docker restart "$CONTAINER_ID"
|
||||||
echo "Deployed commit $CI_COMMIT_SHA to casko.dev container $CONTAINER_ID"
|
echo "Deployed commit $CI_COMMIT_SHA to $HOST_SITE via container $CONTAINER_ID"
|
||||||
Reference in New Issue
Block a user