Skip to content

Merge pull request #34 from CAUSOLDOUTMEN/feat/32-clova-ocr #31

Merge pull request #34 from CAUSOLDOUTMEN/feat/32-clova-ocr

Merge pull request #34 from CAUSOLDOUTMEN/feat/32-clova-ocr #31

name: Diareat OCR CI/CD
on:
push:
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 "${{ secrets.DOCKERHUB_TOKEN }}" | sudo docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
sudo docker rm $(sudo docker stop $(sudo docker ps -a -q --filter ancestor=synoti21/diareat_ocr:latest --format="{{.ID}}"))
sudo docker rmi synoti21/diareat_ocr:latest
sudo docker pull synoti21/diareat_ocr:latest
sudo docker run -d -p 8000:8000 --name diareat_ocr --runtime=nvidia --gpus=all synoti21/diareat_ocr:latest
sleep 10s
sudo docker ps | grep synoti21/diareat_ocr:latest