-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.39 KB
/
distribute.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
42
43
44
45
name: Distribute
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
distribute:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'yarn'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images backend api
run: |
docker build -t siontama/lifepoo:latest . --platform linux/x86_64
docker push siontama/lifepoo:latest
- name: Deploy lifepoo
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
port: ${{ secrets.SERVER_PORT }}
key: ${{ secrets.SERVER_KEY}}
timeout: 60s
script: |
cd ~/LifePoop_Server
docker pull siontama/lifepoo:latest
docker-compose stop api
# docker-compose start api # 기존 이미지로 서버가 뜸
docker-compose up -d api
docker image prune -f # 이미지가 업데이트 되었으므로 이전 이미지 삭제