File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deployment CAPEC-Rag
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ deploy-to-vm :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout Repository
14+ uses : actions/checkout@v3
15+
16+ - name : Set up SSH
17+ uses :
webfactory/[email protected] 18+ with :
19+ ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
20+
21+ - name : Add Azure VM to known_hosts
22+ run : |
23+ mkdir -p ~/.ssh
24+ ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts
25+
26+ - name : Synchronize Code with VM Using rsync
27+ env :
28+ RSYNC_RSH : " ssh"
29+ run : |
30+ rsync -avz --checksum --exclude='.git' ./ ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/home/dev/
31+
32+ - name : Restart Docker Compose Services
33+ 34+ with :
35+ host : ${{ secrets.VM_HOST }}
36+ username : ${{ secrets.VM_USER }}
37+ key : ${{ secrets.SSH_PRIVATE_KEY }}
38+ script : |
39+ echo "Stopping existing Docker Compose services..."
40+ cd /home/dev/
41+ sudo docker-compose down
42+ echo "Starting Docker Compose services..."
43+ sudo docker-compose build --no-cache
44+ sudo docker-compose up -d
45+ echo "Successfully deployed the application!"
You can’t perform that action at this time.
0 commit comments