-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (40 loc) · 1.34 KB
/
diareat_ocr_cicd.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Diareat OCR CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker login
uses: docker/[email protected]
with:
username: synoti21
password: ${{ secrets.DOCKERHUB_TOKEN }}
logout: true
- name: Build and push to DockerHub
run: |
docker build -t diareat_ocr .
docker tag diareat_ocr:latest synoti21/diareat_ocr:latest
docker push synoti21/diareat_ocr:latest
CD:
needs: CI
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2 / Check bot status
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
script: |
echo "AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }}" > env.list
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> env.list
echo "REGION_NAME=${{ secrets.REGION_NAME }}" >> env.list
echo "BUCKET_NAME=${{ secrets.BUCKET_NAME }}" >> env.list
sudo docker pull synoti21/diareat_ocr:latest
sudo docker-compose --env-file=env.list up -d ocr
sudo docker image prune -f