-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (59 loc) · 2.27 KB
/
ci-cd.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: CI/CD
on:
push:
branches:
- development
concurrency:
group: cloud-canvas
jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: NCP registry login
uses: docker/login-action@v3
with:
registry: ${{ secrets.NCP_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: Docker front image build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/client/Dockerfile
push: true
tags: |
cloud-canvas.kr.ncr.ntruss.com/front:dev
cloud-canvas.kr.ncr.ntruss.com/front:${{ github.sha }}
- name: Docker front-hub image build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/hub/Dockerfile
push: true
tags: |
cloud-canvas.kr.ncr.ntruss.com/front-hub:dev
cloud-canvas.kr.ncr.ntruss.com/front-hub:${{ github.sha }}
- name: Docker back image build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/server/Dockerfile
push: true
tags: |
cloud-canvas.kr.ncr.ntruss.com/back:dev
cloud-canvas.kr.ncr.ntruss.com/back:${{ github.sha }}
CD:
needs: CI
runs-on: ubuntu-latest
steps:
- name: Add SSH known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -p ${{ secrets.NCP_DEV_INSTANCE_PORT }} ${{ secrets.NCP_DEV_INSTANCE }} >> ~/.ssh/known_hosts
- name: SSH login and deploy
run: |
printf "%s" "${{ secrets.NCP_DEV_SSH }}" > dev_login.pem
chmod 600 dev_login.pem
ssh -t -i dev_login.pem ncloud@${{ secrets.NCP_DEV_INSTANCE }} -p ${{ secrets.NCP_DEV_INSTANCE_PORT }} './docker.sh'