-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·68 lines (51 loc) · 1.68 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·68 lines (51 loc) · 1.68 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
63
64
65
66
67
68
#!/bin/bash
# Deployment script for LeftPlot Backend
# This script demonstrates the proper deployment process
set -e # Exit on any error
echo "🚀 Starting LeftPlot Backend Deployment..."
# Step 1: Run tests locally first (optional but recommended)
echo "🧪 Running tests locally..."
npm test
if [ $? -ne 0 ]; then
echo "❌ Tests failed! Aborting deployment."
exit 1
fi
echo "✅ Tests passed!"
# Step 2: Build Docker image with multi-stage build
echo "🐳 Building Docker image..."
docker build --target production -t leftplot-backend:latest .
if [ $? -ne 0 ]; then
echo "❌ Docker build failed!"
exit 1
fi
echo "✅ Docker image built successfully!"
# Step 3: Optional - Run containerized tests
echo "🧪 Running tests in Docker container..."
docker build --target test -t leftplot-backend:test .
docker run --rm leftplot-backend:test npm test
if [ $? -ne 0 ]; then
echo "❌ Containerized tests failed!"
exit 1
fi
echo "✅ Containerized tests passed!"
# Step 4: Deploy (example - replace with your actual deployment commands)
echo "🚀 Deploying application..."
# Example deployment commands (customize for your platform):
# For Docker Compose:
# docker-compose up -d
# For Kubernetes:
# kubectl apply -f k8s/
# For cloud platforms:
# docker push your-registry/leftplot-backend:latest
echo "✅ Deployment completed successfully!"
echo ""
echo "📋 Summary:"
echo "- Tests run and passed"
echo "- Production Docker image built (without test files)"
echo "- Application deployed"
echo ""
echo "🔍 The production image contains:"
echo "- Only production dependencies"
echo "- No test files"
echo "- No development tools"
echo "- Optimized for security and performance"