Skip to content

Commit

Permalink
Merge pull request #229 from boostcampwm-2024/nks-test
Browse files Browse the repository at this point in the history
chore: SourceBuild 대신 Actions에서 빌드하도록 수정
  • Loading branch information
dev-taewon-kim authored Dec 3, 2024
2 parents b94658f + 2b81acd commit 5c1747d
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 7 deletions.
76 changes: 73 additions & 3 deletions .github/workflows/ncp_push.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,89 @@
name: Push to Naver Cloud Source Commit Repo
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:
push_to_ncp:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 전체 히스토리 가져오기
fetch-depth: 0

# Copy Dockerfiles to root directory
- name: Copy Dockerfiles to root
run: |
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"
Expand Down
4 changes: 3 additions & 1 deletion .nks/clovapatra-fe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
image: clovapatra-container-registry.kr.ncr.ntruss.com/clovapatra-fe:latest
ports:
- containerPort: 80
command: ["nginx"]
args: ["-g", "daemon off;"]
nodeSelector:
ncloud.com/nks-nodepool: fe-nginx
imagePullSecrets:
Expand Down Expand Up @@ -54,7 +56,7 @@ metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
alb.ingress.kubernetes.io/ssl-certificate-no: "35205"
alb.ingress.kubernetes.io/ssl-certificate-no: "35255"
alb.ingress.kubernetes.io/ssl-redirect: "443"
alb.ingress.kubernetes.io/healthcheck-path: "/"
spec:
Expand Down
4 changes: 3 additions & 1 deletion .nks/clovapatra-game.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
value: "6379"
- name: REDIS_PASSWORD
value: ""
command: ["node"]
args: ["dist/main.js"]
nodeSelector:
ncloud.com/nks-nodepool: game
imagePullSecrets:
Expand Down Expand Up @@ -63,7 +65,7 @@ metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
alb.ingress.kubernetes.io/ssl-certificate-no: "35205"
alb.ingress.kubernetes.io/ssl-certificate-no: "35255"
alb.ingress.kubernetes.io/ssl-redirect: "443"
alb.ingress.kubernetes.io/healthcheck-path: "/api/rooms/health-check"
spec:
Expand Down
4 changes: 3 additions & 1 deletion .nks/clovapatra-signaling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
value: "6379"
- name: REDIS_PASSWORD
value: ""
command: ["node"]
args: ["src/main.js"]
nodeSelector:
ncloud.com/nks-nodepool: signaling
imagePullSecrets:
Expand Down Expand Up @@ -63,7 +65,7 @@ metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
alb.ingress.kubernetes.io/ssl-certificate-no: "35205"
alb.ingress.kubernetes.io/ssl-certificate-no: "35255"
alb.ingress.kubernetes.io/ssl-redirect: "443"
alb.ingress.kubernetes.io/healthcheck-path: "/health-check"
spec:
Expand Down
4 changes: 3 additions & 1 deletion .nks/clovapatra-voice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ spec:
value: ""
- name: REDIS_ROOM_KEY_EXPIRE_TIME
value: "60000"
command: ["node"]
args: ["src/main.js"]
nodeSelector:
ncloud.com/nks-nodepool: voice
imagePullSecrets:
Expand Down Expand Up @@ -72,7 +74,7 @@ metadata:
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS":443}]'
alb.ingress.kubernetes.io/ssl-certificate-no: "35205"
alb.ingress.kubernetes.io/ssl-certificate-no: "35255"
alb.ingress.kubernetes.io/ssl-redirect: "443"
alb.ingress.kubernetes.io/healthcheck-path: "/health-check"
spec:
Expand Down
3 changes: 3 additions & 0 deletions .nks/voice_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:21.7.3-alpine

# Install ffmpeg
RUN apk add --no-cache ffmpeg

WORKDIR /app

# Copy package.json and package-lock.json
Expand Down

0 comments on commit 5c1747d

Please sign in to comment.