-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (38 loc) · 1.31 KB
/
main.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
name: Model Serving
on:
pull_request:
branches: ['develop'] # develop 브랜치에 pull request될 때 동작
push:
branches: ['develop'] # develop 브랜치에 push될 때 동작
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_PASSWORD}}
- name: Build docker file and setting deploy files
run: |
docker build -t makezenerator/serving:latest serving/
docker push makezenerator/serving:latest
cd:
runs-on: ubuntu-latest
needs: [ci]
steps:
- name: Connect to server
uses: appleboy/ssh-action@master
with:
host: ${{secrets.SERVER3_HOST}}
username: ${{secrets.SERVER_USERNAME}}
key: ${{secrets.SERVER3_KEY}}
port: ${{secrets.SERVER_PORT}}
script: |
docker login -u "${{secrets.DOCKERHUB_USERNAME}}" -p "${{secrets.DOCKERHUB_PASSWORD}}"
docker stop $(docker ps -a -q)
docker rm -f $(docker ps -a -q)
docker pull makezenerator/serving:latest
docker run -d -p 5050:5050 makezenerator/serving:latest
docker image prune -f