siftlode/deploy/deploy.sh
npeter83 dbf0a95d5b ci(deploy): pull the prebuilt published image in prod instead of building on host
The prod compose api service now references the published Forgejo image
(tag = released VERSION) and deploy.sh pulls it rather than running a host
build. The image carries its baked-in version/sha/build-date from publish.
2026-06-21 03:23:23 +02:00

26 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Roll out the latest main branch to the public VPS instance.
#
# Layout on the host:
# /srv/siftlode/src git clone of this repo (compose file + VERSION)
# /srv/siftlode/.env secrets, mode 0600 (never in git)
#
# The app is no longer built on the host — it's pulled as the prebuilt image published by
# `siftlode publish`. We still sync the repo to pick up the new compose file + VERSION (which
# selects the image tag to pull); the version/sha/build-date are baked into that image.
set -euo pipefail
ROOT=/srv/siftlode
cd "$ROOT/src"
git fetch --quiet origin
git checkout --quiet main
git pull --ff-only --quiet
# The released version selects the published image tag to pull.
export APP_VERSION="$(cat VERSION 2>/dev/null || echo latest)"
docker compose -f docker-compose.prod.yml --env-file "$ROOT/.env" pull
docker compose -f docker-compose.prod.yml --env-file "$ROOT/.env" up -d
docker image prune -f >/dev/null || true
docker compose -f docker-compose.prod.yml --env-file "$ROOT/.env" ps