ci(deploy): auto-deploy prod stack after image build on merge to main #63
Reference in New Issue
Block a user
No description provided.
Delete Branch "ci/auto-deploy-on-merge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds a
deployjob to.gitea/workflows/build-images.ymlso that every merge tomainbuilds the images and rolls production onto them.How
Two jobs now run in sequence in the same workflow:
ubuntu-latest) — builds & pusheswebsite-app/website-botimages (unchanged).uom_deploy) — new.needs: build, so it only starts after a clean build+push. On the production host it runs::latestimages (docker-compose.ymldefaultsIMAGE_TAG=latest).Behavior / safety
needs: buildmeans a failed build never tears down the running stack — deploy simply doesn't fire.if: github.ref == 'refs/heads/main'so aworkflow_dispatchoff another branch can't deploy to prod.pull → down → up -dsequence (down included by request). Compose only recreates services whose image digest changed, so the DB stays put.Prerequisite (one-time)
A second self-hosted runner labelled
uom_deploymust live on the production host, with access to the Docker daemon and to/home/perry/website(the dir holding the proddocker-compose.yml+.env). Registry auth is already handled on the host, so nodocker loginstep is needed in the job.Follow-up (optional, not in this PR)
Old
sha-<7>images accumulate on the host over time; adocker image prune -fcould be added to the deploy job later if disk creep becomes an issue.🤖 Generated with Claude Code