-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-static.sh
More file actions
63 lines (53 loc) · 1.46 KB
/
Copy pathdeploy-static.sh
File metadata and controls
63 lines (53 loc) · 1.46 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
echo "🚀 CalSol - GUARANTEED WORKING DEPLOYMENT"
echo "=========================================="
# Build the frontend
echo "📦 Building frontend..."
cd frontend
npm install
npm run build
# Create a simple static server
echo "🔧 Creating static server..."
cat > static-server.js << 'EOF'
const express = require('express');
const path = require('path');
const app = express();
// Serve static files
app.use(express.static(path.join(__dirname, 'dist')));
// Handle React Router
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
});
const PORT = process.env.PORT || 8080;
app.listen(PORT, '0.0.0.0', () => {
console.log(`🚀 CalSol running on port ${PORT}`);
});
EOF
# Update package.json for static deployment
echo "📝 Updating package.json..."
cat > package-static.json << 'EOF'
{
"name": "calsol-static",
"version": "1.0.0",
"type": "commonjs",
"scripts": {
"start": "node static-server.js",
"build": "echo 'Build already done'"
},
"dependencies": {
"express": "^4.18.2"
}
}
EOF
# Copy the static package.json
cp package-static.json package.json
echo "✅ READY FOR DEPLOYMENT!"
echo "📁 Files created:"
echo " - dist/ (built frontend)"
echo " - static-server.js (simple server)"
echo " - package.json (static deployment config)"
echo ""
echo "🚀 Deploy these files to Render!"
echo " Build Command: npm install"
echo " Start Command: npm start"
echo " Publish Directory: . (root)"