-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (32 loc) · 1.11 KB
/
Deploy.yml
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
name: Connect Pull and Deploy
on:
push:
branches: ["main"]
schedule:
- cron: "25 13 * * 1" # Daily at 3:00 PM UTC
jobs:
docker-login:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Deploy to Ec2 instance
uses: appleboy/ssh-action@master
with:
host: ${{secrets.EC2_HOST}}
username: ${{secrets.EC2_USERNAME}}
key: ${{secrets.EC2_PRIVATE_KEY}}
script: |
sudo docker stop cabmanagement || true
sudo docker rm cabmanagement || true
sudo docker rmi notprasanna/versavolt:cab-image-latest
sudo docker ps
sudo docker pull notprasanna/versavolt:cab-image-latest
sudo docker images
sudo docker run -d -p 8080:8080 --network springbootapi --name cabmanagement notprasanna/versavolt:cab-image-latest
sudo docker start cabmanagement
sudo docker ps