-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·36 lines (31 loc) · 948 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·36 lines (31 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
echo "🚀 Phala Cloud X402 Entrypoint Script"
echo "======================================"
# Check if pnpm is installed, install if not
if ! command -v pnpm &> /dev/null; then
echo "📦 pnpm not found, installing pnpm..."
npm install -g pnpm
echo "✅ pnpm installed successfully"
else
echo "✅ pnpm is already installed"
fi
# Install dependencies if node_modules doesn't exist or package.json changed
if [ ! -d "node_modules" ] || [ "package.json" -nt "node_modules" ]; then
echo "📦 Installing dependencies..."
pnpm install
else
echo "✅ Dependencies already installed"
fi
# Check if running in development or production mode
MODE="${1:-prod}"
if [ "$MODE" = "dev" ]; then
echo "🔧 Starting in DEVELOPMENT mode..."
exec pnpm run dev
else
echo "🏭 Starting in PRODUCTION mode..."
echo "🔨 Building project..."
pnpm run build
echo "▶️ Starting server..."
exec pnpm run start
fi