Website deploy: run the image tagged current, so plain compose commands work on the server
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-19 11:15:37 +03:00
parent 02fc61b88c
commit c8e33e4ecd
2 changed files with 8 additions and 5 deletions

View file

@ -39,7 +39,8 @@ rollback)
remote "${dir}" <<'SH'
set -e; cd "$1"
prev="$(cat .previous)"; cur="$(cat .deployed)"
SITE_TAG="${prev}" docker compose up -d
docker tag "chesspenguin-site:${prev}" chesspenguin-site:current
docker compose up -d
echo "${prev}" > .deployed; echo "${cur}" > .previous
SH
wait_healthy
@ -61,11 +62,12 @@ deploy)
set -e; cd "$1"
[ -f .env ] || { echo ".env is missing in $1 (see .env.example)"; exit 1; }
cur="$(cat .deployed 2>/dev/null || true)"
SITE_TAG="$2" docker compose up -d
docker tag "chesspenguin-site:$2" chesspenguin-site:current
docker compose up -d
if [ -n "${cur}" ] && [ "${cur}" != "$2" ]; then echo "${cur}" > .previous; fi
echo "$2" > .deployed
# Keep the three newest images for rollbacks.
docker image ls chesspenguin-site --format '{{.Tag}}' | tail -n +4 | grep -vx -e "$2" -e "${cur}" \
docker image ls chesspenguin-site --format '{{.Tag}}' | tail -n +4 | grep -vx -e current -e "$2" -e "${cur}" \
| xargs -r -I{} docker image rm -f "chesspenguin-site:{}" >/dev/null || true
SH
wait_healthy