-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·61 lines (49 loc) · 1.79 KB
/
deploy.sh
File metadata and controls
executable file
·61 lines (49 loc) · 1.79 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
#!/bin/bash
set -e
echo "🚀 Deploying GitHub Starred Repositories Application"
BACKEND_PORT=${BACKEND_PORT:-8090}
FRONTEND_PORT=${FRONTEND_PORT:-3000}
echo ""
echo "📦 Building application..."
./build.sh
echo ""
echo "🐳 Creating Docker images..."
if command -v docker &> /dev/null; then
echo "Building backend Docker image..."
docker build -t github-starred-backend:latest -f Dockerfile.backend .
echo "Building frontend Docker image..."
docker build -t github-starred-frontend:latest -f Dockerfile.frontend .
echo ""
echo "✅ Docker images created!"
echo ""
echo "🚀 Starting containers..."
docker network create github-starred-network 2>/dev/null || true
docker run -d \
--name github-starred-backend \
--network github-starred-network \
-p $BACKEND_PORT:8090 \
-v $(pwd)/backend/pb_data:/app/pb_data \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
github-starred-backend:latest
docker run -d \
--name github-starred-frontend \
--network github-starred-network \
-p $FRONTEND_PORT:3000 \
-e NEXT_PUBLIC_API_URL=http://localhost:$BACKEND_PORT \
github-starred-frontend:latest
echo ""
echo "✅ Deployment completed!"
echo ""
echo "🌐 Frontend: http://localhost:$FRONTEND_PORT"
echo "🔧 Backend API: http://localhost:$BACKEND_PORT"
echo ""
echo "To view logs:"
echo " Backend: docker logs github-starred-backend"
echo " Frontend: docker logs github-starred-frontend"
else
echo "⚠️ Docker not found. Please install Docker or use the manual deployment method."
echo ""
echo "Manual deployment:"
echo " 1. Backend: cd backend && ./github-collector serve"
echo " 2. Frontend: cd frontend && npm start"
fi