Add Jenkinsfile and deploy script (build on NAS checkout, compose up -d).
docker-registry-aio/pipeline/head This commit looks good
docker-registry-aio/pipeline/head This commit looks good
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7dad0ed0c
commit
421e8062e6
3 files changed
+132
No files matched your search
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# Rebuild the app image from the current checkout and bring the stack up.
|
||||
# Run from anywhere; used by the Jenkins Deploy stage and for manual deploys.
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
HEALTH_TIMEOUT="${HEALTH_TIMEOUT:-180}"
|
||||
|
||||
echo "deploy: $(git log -1 --format='%h %s' 2>/dev/null || echo unknown)"
|
||||
|
||||
docker compose config -q
|
||||
docker compose build app
|
||||
docker compose up -d
|
||||
|
||||
# registry's healthcheck always passes, so the app health is what tells us the deploy worked.
|
||||
cid="$(docker compose ps -q app)"
|
||||
elapsed=0
|
||||
while :; do
|
||||
status="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$cid")"
|
||||
case "$status" in
|
||||
healthy) break ;;
|
||||
unhealthy|exited|dead)
|
||||
echo "deploy: app is $status" >&2
|
||||
docker compose logs --tail 50 app >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
if [ "$elapsed" -ge "$HEALTH_TIMEOUT" ]; then
|
||||
echo "deploy: app not healthy after ${HEALTH_TIMEOUT}s (status: $status)" >&2
|
||||
docker compose logs --tail 50 app >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
elapsed=$((elapsed + 5))
|
||||
done
|
||||
|
||||
docker compose ps
|
||||
echo "deploy: done"
|
||||
Reference in new issue
Block a user