More attempts to fix docker

This commit is contained in:
2025-04-21 23:22:32 +02:00
parent 063877bc09
commit 2e265c08f1
17 changed files with 1567 additions and 116 deletions

View File

@@ -1,20 +1,22 @@
import { spawn } from 'child_process';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { svelteKitPort } from './src/proxy-websocket-server.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
// Start the WebSocket server
console.log('Starting WebSocket server');
const wsServer = spawn('node', ['src/websocket-server.js'], {
// Start the SvelteKit production server on internal port
console.log(`Starting SvelteKit production server on internal port ${svelteKitPort}`);
const sveltekit = spawn('node', ['build/index.js'], {
stdio: 'inherit',
shell: true,
cwd: __dirname
cwd: __dirname,
env: { ...process.env, PORT: svelteKitPort }
});
// Start the SvelteKit production server
console.log('Starting SvelteKit production server');
const sveltekit = spawn('node', ['build/index.js'], {
// Start the Proxy WebSocket server on the main port (3000)
console.log('Starting Proxy WebSocket server on public port 3000');
const proxyServer = spawn('node', ['src/proxy-websocket-server.js'], {
stdio: 'inherit',
shell: true,
cwd: __dirname
@@ -23,14 +25,14 @@ const sveltekit = spawn('node', ['build/index.js'], {
// Handle process exit
process.on('exit', () => {
console.log('Shutting down servers...');
wsServer.kill();
proxyServer.kill();
sveltekit.kill();
});
// Handle ctrl+c
process.on('SIGINT', () => {
console.log('Received SIGINT, shutting down servers...');
wsServer.kill('SIGINT');
proxyServer.kill('SIGINT');
sveltekit.kill('SIGINT');
process.exit(0);
});
@@ -38,7 +40,7 @@ process.on('SIGINT', () => {
// Handle termination
process.on('SIGTERM', () => {
console.log('Received SIGTERM, shutting down servers...');
wsServer.kill('SIGTERM');
proxyServer.kill('SIGTERM');
sveltekit.kill('SIGTERM');
process.exit(0);
});