Skip to content

fix: 컨테이너가 제대로 실행되도록 Dockerfile 재작성 (#19) #17

fix: 컨테이너가 제대로 실행되도록 Dockerfile 재작성 (#19)

fix: 컨테이너가 제대로 실행되도록 Dockerfile 재작성 (#19) #17

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