-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (34 loc) · 1.13 KB
/
deploy.yml
File metadata and controls
39 lines (34 loc) · 1.13 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
name: AI Model Docker Hub Push
on:
push:
branches: ["release"]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
# jjy12163/ai-model:latest 태그로 Push
tags: ${{ secrets.DOCKERHUB_USERNAME }}/ai-model:latest
# 🚀 옵션: AI 서버가 업데이트되었을 때 EC2에 접속해서 ai-server 컨테이너만 재시작
- name: Update EC2 AI Container
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
script: |
cd /home/ubuntu/deploy
sudo docker compose pull ai-server
sudo docker compose up -d ai-server
sudo docker image prune -f