-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (44 loc) · 1.27 KB
/
Copy pathdocker.yml
File metadata and controls
61 lines (44 loc) · 1.27 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
name: Build Push and Deploy
on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Backend Image
run: |
docker build -t ayusnath/ai-backend:latest ./ai-interview-Backend
- name: Push Backend Image
run: |
docker push ayusnath/ai-backend:latest
- name: Build Frontend Image
run: |
docker build -t ayusnath/ai-frontend:latest ./ai-interview-Frontend
- name: Push Frontend Image
run: |
docker push ayusnath/ai-frontend:latest
deploy:
needs: docker
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/ai-interview
docker-compose pull
docker-compose down
docker-compose up -d
docker image prune -f