Docker, API proxy, Drone CI, .env
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Serves the SSR server by running the built main.js.
|
||||
* Angular 19 server build outputs main.<hash>.js.
|
||||
*/
|
||||
const { readdirSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const serverDir = join(process.cwd(), 'dist', 'goals-tracker', 'server');
|
||||
const files = readdirSync(serverDir);
|
||||
const mainFile = files.find((f) => f.startsWith('main.') && f.endsWith('.js'));
|
||||
|
||||
if (!mainFile) {
|
||||
console.error('Server build not found. Run: bun run build:ssr');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const child = spawn(process.execPath, [join(serverDir, mainFile)], {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, NODE_ENV: 'production' },
|
||||
});
|
||||
|
||||
child.on('exit', (code) => process.exit(code ?? 0));
|
||||
Reference in New Issue
Block a user