prod.sh: regenerate and auto-commit docker-compose.dokploy.yml automatically
Folds the step the user would otherwise have to remember to run by hand (./generate-dokploy-compose.sh, after any bettersightbox-index.html change) directly into the ship flow -- runs after the clean-tree check (so this auto-commit never mixes with unrelated uncommitted work) and before the test gate, auto-committing only if the regenerated file actually differs (i.e. the marketing content-hash changed, or docker-compose.yml itself did). dev.sh doesn't need the equivalent, since local dev never reads docker-compose.dokploy.yml at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
This commit is contained in:
parent
219af05c74
commit
e8070f73d6
|
|
@ -25,23 +25,33 @@
|
||||||
# nothing after it ever runs:
|
# nothing after it ever runs:
|
||||||
# 1. Branch check — exits unless currently on main.
|
# 1. Branch check — exits unless currently on main.
|
||||||
# 2. Clean-tree check — exits if `git status --porcelain` shows anything
|
# 2. Clean-tree check — exits if `git status --porcelain` shows anything
|
||||||
# uncommitted, so what ships always matches an actual commit.
|
# uncommitted, so what ships always matches an actual commit (checked
|
||||||
# 3. Loads scripts/.env.prod — exits if it doesn't exist yet; otherwise
|
# BEFORE step 3's own regenerate-and-commit, so that auto-commit is
|
||||||
|
# never mixed in with unrelated uncommitted work).
|
||||||
|
# 3. Regenerates docker-compose.dokploy.yml (./generate-dokploy-compose.sh)
|
||||||
|
# and auto-commits it if the content-hash (or anything else) changed —
|
||||||
|
# this is the one thing this script commits on its own, scoped to
|
||||||
|
# exactly this generated file. Without this, an edit to
|
||||||
|
# bettersightbox-index.html with no other docker-compose.yml change
|
||||||
|
# would ship with a stale content-hash and the marketing container
|
||||||
|
# would silently never get recreated — see that service's own comment
|
||||||
|
# in docker-compose.yml for the full story.
|
||||||
|
# 4. Loads scripts/.env.prod — exits if it doesn't exist yet; otherwise
|
||||||
# exports the real CUSTOM_IMAGE/CUSTOM_TAG/BACKEND_BILLING_IMAGE/
|
# exports the real CUSTOM_IMAGE/CUSTOM_TAG/BACKEND_BILLING_IMAGE/
|
||||||
# BACKEND_BILLING_TAG registry paths into this shell.
|
# BACKEND_BILLING_TAG registry paths into this shell.
|
||||||
# 4. Runs backend/tests/ via pytest — any failure stops here, before
|
# 5. Runs backend/tests/ via pytest — any failure stops here, before
|
||||||
# anything is built or pushed.
|
# anything is built or pushed.
|
||||||
# 5. ./erpnext-image/build.sh — sees the registry-path CUSTOM_IMAGE from
|
# 6. ./erpnext-image/build.sh — sees the registry-path CUSTOM_IMAGE from
|
||||||
# step 3, takes its registry branch: builds for linux/amd64 via
|
# step 4, takes its registry branch: builds for linux/amd64 via
|
||||||
# buildx (not this machine's own arch) and pushes straight to the
|
# buildx (not this machine's own arch) and pushes straight to the
|
||||||
# registry.
|
# registry.
|
||||||
# 6. ./backend/build.sh — same thing for backend-billing: builds for
|
# 7. ./backend/build.sh — same thing for backend-billing: builds for
|
||||||
# linux/amd64, pushes to the registry. DOKPLOY_URL/DOKPLOY_API_TOKEN/
|
# linux/amd64, pushes to the registry. DOKPLOY_URL/DOKPLOY_API_TOKEN/
|
||||||
# DOKPLOY_COMPOSE_ID are deliberately unset (see above), so this step
|
# DOKPLOY_COMPOSE_ID are deliberately unset (see above), so this step
|
||||||
# stops after pushing — it does not call Dokploy's API itself.
|
# stops after pushing — it does not call Dokploy's API itself.
|
||||||
# 7. git push origin main — the actual deploy trigger. Dokploy's
|
# 8. git push origin main — the actual deploy trigger (carries step 3's
|
||||||
# AutoDeploy watches main and redeploys on push, pulling both
|
# auto-commit too, if one happened). Dokploy's AutoDeploy watches main
|
||||||
# freshly-pushed images.
|
# and redeploys on push, pulling both freshly-pushed images.
|
||||||
#
|
#
|
||||||
# Usage: ./scripts/prod.sh
|
# Usage: ./scripts/prod.sh
|
||||||
|
|
||||||
|
|
@ -62,6 +72,18 @@ if [ -n "$(git status --porcelain)" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Regenerating docker-compose.dokploy.yml..."
|
||||||
|
./generate-dokploy-compose.sh
|
||||||
|
if [ -n "$(git status --porcelain -- docker-compose.dokploy.yml)" ]; then
|
||||||
|
git add docker-compose.dokploy.yml
|
||||||
|
git commit -m "Regenerate docker-compose.dokploy.yml
|
||||||
|
|
||||||
|
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>"
|
||||||
|
echo "Committed updated docker-compose.dokploy.yml (content-hash changed)."
|
||||||
|
else
|
||||||
|
echo "docker-compose.dokploy.yml already up to date."
|
||||||
|
fi
|
||||||
|
|
||||||
PROD_ENV="${SCRIPT_DIR}/.env.prod"
|
PROD_ENV="${SCRIPT_DIR}/.env.prod"
|
||||||
if [ ! -f "$PROD_ENV" ]; then
|
if [ ! -f "$PROD_ENV" ]; then
|
||||||
echo "Missing ${PROD_ENV} — copy scripts/.env.prod.example and fill in the real registry paths first." >&2
|
echo "Missing ${PROD_ENV} — copy scripts/.env.prod.example and fill in the real registry paths first." >&2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue