#!/usr/bin/env bash # Local iteration loop: build both custom images for this machine's own # architecture (fast, no registry push — see erpnext-image/build.sh and # backend/build.sh's own local-vs-registry branching), bring the ERPNext # stack's affected services up, and bring up website/'s own stack (a # completely separate Compose project — bi.bettersight.io, # bettersight.io, and their shared backend) too. Run this as often as you # want while developing; nothing here touches git or any registry — see # scripts/prod.sh for shipping what you've tested here. # # What happens when this runs, in order: # 1. ./generate-dokploy-compose.sh — regenerates docker-compose.dokploy.yml, # including a fresh marketing content-hash label (the current git # commit SHA — see that script's own comment for why it has to be # every deploy, not just bettersightbox-index.html edits). Not # committed here — dev.sh never touches git; prod.sh is the only one # that commits, gated behind its own clean-tree/test checks. # 2. ./erpnext-image/build.sh — CUSTOM_IMAGE in the root .env is a bare # local tag (not a registry path), so this takes the local branch: # builds sightbox-erpnext for this machine's own architecture, no push. # 3. ./backend/build.sh — same thing for BACKEND_BILLING_IMAGE: builds # sightbox-backend-billing locally, no push. # 4. docker compose up -d --force-recreate on every service that runs # from either image — the seven ERPNext-image services (configurator, # backend, frontend, websocket, queue-short, queue-long, scheduler) # plus backend-billing — so the freshly-built images actually get # picked up. (Compose has no "recreate everyone using image X" — it # only accepts service names, so all eight get listed individually # even though only one or two images actually changed.) marketing is # force-recreated here too — its own content-hash label only changes # via generate-dokploy-compose.sh's literal-value substitution # (step 1), which this script never runs against the LOCAL # docker-compose.yml, so a plain `up -d` would never notice a # bettersightbox-index.html edit locally either, same root cause as # the production staleness bug that label exists to fix. # 5. website/'s own `docker compose up -d --build` — separate Compose # project (see website/docker-compose.yml, website/README.md), no # content-hash trick needed there since every one of its services # gets rebuilt from source on every run of this step. # # Usage (from the sightbox/ project root or from here — either works): # ./scripts/dev.sh set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" cd "$ROOT_DIR" ./generate-dokploy-compose.sh ./erpnext-image/build.sh ./backend/build.sh echo echo "Bringing up the affected services locally..." docker compose up -d --force-recreate \ configurator backend frontend websocket queue-short queue-long scheduler \ backend-billing marketing echo echo "Bringing up website/'s own stack (bi.bettersight.io, bettersight.io, shared backend)..." ( cd website && docker compose up -d --build ) echo echo "Done — test against your local stack now."