RaBU1234 commited on
Commit
4e0b6cb
Β·
verified Β·
1 Parent(s): 98fd0f7

Create entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +36 -0
entrypoint.sh ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "πŸš€ Starting Sandbox Server..."
5
+
6
+ # Start Node.js server in background
7
+ echo "πŸ“¦ Starting Node.js API server on port 3001..."
8
+ node /app/server.js &
9
+ NODE_PID=$!
10
+
11
+ # Wait for Node.js to be ready
12
+ echo "⏳ Waiting for Node.js server to start..."
13
+ sleep 5
14
+
15
+ # Check if Node.js is running
16
+ if ! kill -0 $NODE_PID 2>/dev/null; then
17
+ echo "❌ Node.js server failed to start"
18
+ exit 1
19
+ fi
20
+
21
+ echo "βœ… Node.js server started successfully"
22
+
23
+ # Test Nginx configuration
24
+ echo "πŸ” Testing Nginx configuration..."
25
+ nginx -t
26
+
27
+ if [ $? -eq 0 ]; then
28
+ echo "βœ… Nginx configuration is valid"
29
+ else
30
+ echo "❌ Nginx configuration is invalid"
31
+ exit 1
32
+ fi
33
+
34
+ # Start Nginx in foreground
35
+ echo "🌐 Starting Nginx on port 7860..."
36
+ exec nginx -g "daemon off;"