-
Notifications
You must be signed in to change notification settings - Fork 4
37 lines (30 loc) · 1007 Bytes
/
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
36
37
name: Deploy rc-fe to staging env (azure)
on:
push:
branches:
- develop
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build the Docker image
run: |
docker build -t pawanlive/rc-fe:latest .
- name: Push the Docker image to Docker Hub
run: |
docker push pawanlive/rc-fe:latest
- name: Deploy to Azure VM
run: |
ssh -o StrictHostKeyChecking=no your-username@${{ secrets.AZURE_VM_IP }} << 'EOF'
sudo docker pull pawanlive/rc-fe:latest
sudo docker stop rc-fe-stage || true
sudo docker rm rc-fe-stage || true
sudo docker run -d --name rc-fe-stage \
-p 3000:3000 \
pawanlive/rc-fe:latest
exit
EOF