diff --git a/README.md b/README.md index 90caa73..f3c636d 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,21 @@ The command waits for both application services to become healthy, then prints the frontend URL. Open `http://localhost:5173`, register a local account, add a repository, and start analysis. Press `Ctrl+C` to stop all four services. +On repeat runs the images are reused from cache, so startup is fast. If you have +already built the images once and only want to restart the existing containers +without the build step, use: + +```bash +npm run partha:up +``` + +To stop the stack without the interactive `Ctrl+C` (for example from another +terminal), use: + +```bash +npm run partha:down +``` + PostgreSQL data and imported repository storage persist across ordinary stops and restarts. To permanently delete that local Compose data and return to a clean state, run: diff --git a/package.json b/package.json index 64e0da2..cde1976 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ ], "scripts": { "partha": "node scripts/partha.mjs", + "partha:up": "node scripts/partha.mjs --no-build", + "partha:down": "docker compose down", "dev:frontend": "npm --prefix apps/frontend run dev", "build:frontend": "npm --prefix apps/frontend run build", "preview:frontend": "npm --prefix apps/frontend run preview", diff --git a/scripts/partha.mjs b/scripts/partha.mjs index 1cd1042..9342da8 100644 --- a/scripts/partha.mjs +++ b/scripts/partha.mjs @@ -11,6 +11,10 @@ let interrupted = false; let startupAttempted = false; let releaseKeepAlive; +// `--no-build` skips image builds for instant restarts once images exist. +const NO_BUILD = process.argv.includes('--no-build'); +const COMPOSE_UP_ARGS = NO_BUILD ? ['up', '--wait'] : ['up', '--build', '--wait']; + function commandOutput(result) { return [result.stdout, result.stderr] .filter(Boolean) @@ -128,7 +132,7 @@ async function main() { try { startupAttempted = true; - await run('docker', ['compose', 'up', '--build', '--wait']); + await run('docker', ['compose', ...COMPOSE_UP_ARGS]); await Promise.all([ waitForUrl(API_READY_URL, 'PARTHA API'), waitForUrl(FRONTEND_URL, 'PARTHA frontend'),