-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 3.26 KB
/
ncp_push.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Build and Deploy to NCP
on:
push:
branches:
- main
env:
REGISTRY: clovapatra-container-registry.kr.ncr.ntruss.com
FE_IMAGE: clovapatra-container-registry.kr.ncr.ntruss.com/clovapatra-fe
GAME_IMAGE: clovapatra-container-registry.kr.ncr.ntruss.com/clovapatra-game
SIGNALING_IMAGE: clovapatra-container-registry.kr.ncr.ntruss.com/clovapatra-signaling
VOICE_IMAGE: clovapatra-container-registry.kr.ncr.ntruss.com/clovapatra-voice
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
# Copy Dockerfiles to root directory
- name: Copy Dockerfiles to root
run: |
echo "${{ secrets.ENV_FE_NKS }}" > ./fe/.env
echo "${{ secrets.ENV_GAME }}" > ./be/gameServer/.env
echo "${{ secrets.ENV_SIGNALING }}" > ./be/signalingServer/.env
echo "${{ secrets.ENV_VOICE }}" > ./be/voiceProcessingServer/.env
cp .nks/fe_Dockerfile ./Dockerfile.fe
cp .nks/game_Dockerfile ./Dockerfile.game
cp .nks/signaling_Dockerfile ./Dockerfile.signaling
cp .nks/voice_Dockerfile ./Dockerfile.voice
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to NCP Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
# Build and push Frontend
- name: Build and push frontend image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.fe
push: true
tags: ${{ env.FE_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Build and push Game Server
- name: Build and push game server image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.game
push: true
tags: ${{ env.GAME_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Build and push Signaling Server
- name: Build and push signaling server image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.signaling
push: true
tags: ${{ env.SIGNALING_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Build and push Voice Processing Server
- name: Build and push voice processing server image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.voice
push: true
tags: ${{ env.VOICE_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Push to NCP Source Commit
- name: Set up Git Config
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Add NCP Remote
run: |
git remote add ncp https://${{ secrets.NCP_USERNAME }}:${{ secrets.NCP_PASSWORD_URL_ENCODED }}@${{ secrets.NCP_REPO_URL }}
- name: Push to NCP Main Branch
run: |
git push ncp main --force