Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CD - Dev

on:
workflow_dispatch:
push:
branches:
- dev

jobs:
build:
name: Build & Push Docker Image
runs-on: ubuntu-latest

steps:
- name: Discord Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
uses: Ilshidur/action-discord@master
with:
args:
'📈 AI predict 서버 배포 시작'

# 코드 체크아웃
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: SSH to EC2 and deploy
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ai-predict-server
git pull
sudo docker stop weathertago-ai-server || true
sudo docker rm -f weathertago-ai-server || true
sudo docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/weathertago-ai-server:latest .
sudo docker run -d --name weathertago-ai-server -p 8000:8000 ${{ secrets.DOCKER_HUB_USERNAME }}/weathertago-ai-server:latest
env:
ACTIONS_RUNNER_DEBUG: true


- name: Discord Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
uses: Ilshidur/action-discord@master
with:
args:
'😎 AI predict 서버 배포 완료됨'

10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY ai_server.py .

CMD ["uvicorn", "ai_server:app", "--host", "0.0.0.0", "--port", "8000"]