Deploy: kill anything holding port 8420 before bringing the new container up
Build and push server image / test (push) Successful in 47s
Build and push server image / build-and-push (push) Successful in 4m14s
Build and push server image / deploy (push) Failing after 1m27s

"docker compose down" before "pull/up" (previous commit) didn't fix the
port conflict -- it only tears down containers this compose project
itself tracks, so a stale/orphaned container from an earlier deploy (or
anything else bound to 8420, especially with restart: unless-stopped
fighting back) slips through untouched and the new "up" fails with
"port is already allocated". This is root-cause-agnostic instead: find
and stop/remove *any* container publishing 8420, compose-managed or
not, right before pull/up. --remove-orphans on the down step too, for
services that used to be in the compose file and aren't anymore.
This commit is contained in:
2026-08-01 12:05:58 +00:00
parent 455020cb1f
commit f209880fd0
+6 -1
View File
@@ -69,4 +69,9 @@ jobs:
ssh-keyscan -p "$DEPLOY_PORT" "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null
ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" -o StrictHostKeyChecking=yes \
espressoframe_deployer@"$DEPLOY_HOST" \
'cd ~/espresso-frame && docker compose down && docker compose pull && docker compose up -d'
'cd ~/espresso-frame && \
docker compose down --remove-orphans && \
docker ps -q --filter publish=8420 | xargs -r docker stop && \
docker ps -aq --filter publish=8420 | xargs -r docker rm && \
docker compose pull && \
docker compose up -d'