Skip to content

[GWL-55] Makefile과 Tuist로 모듈 및 데모 앱 생성 명령어 구현 #11

[GWL-55] Makefile과 Tuist로 모듈 및 데모 앱 생성 명령어 구현

[GWL-55] Makefile과 Tuist로 모듈 및 데모 앱 생성 명령어 구현 #11

Workflow file for this run

name: BackEnd-CI
on:
push:
branches: 'feature/BE/*'
pull_request:
branches: 'develop'
types: [labeled, opened, synchronize, reopened]
jobs:
test:
if: contains(github.event.pull_request.labels.*.name, '💻백엔드')
runs-on: ubuntu-latest
steps:
- name: 코드 체크아웃
uses: actions/checkout@v2
- name: node 세팅
uses: actions/setup-node@v1
with:
node-version: '18'
- name: 의존성 설치
run: npm ci
working-directory: ./BackEnd
- name: 테스트 진행
run: npm test
working-directory: ./BackEnd
deploy:
needs: test
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v1
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- uses: docker/build-push-action@v2
with:
context: .
file: ./BackEnd/Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/my-app:latest
- name: SSH Tunneling and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BASTION_HOST }}
username: ${{ secrets.BASTION_USER }}
key: ${{ secrets.BASTION_SSH_KEY }}
script: |
ssh -o StrictHostKeyChecking=no -L 9999:${{ secrets.INTERNAL_SERVER_IP }}:22 ${{ secrets.BASTION_USER }}@localhost -i ${{ secrets.BASTION_SSH_PRIVATE_KEY_PATH }} -fN
ssh -o StrictHostKeyChecking=no -p 9999 ${{ secrets.SERVER_USER }}@localhost -i ${{ secrets.SERVER_SSH_PRIVATE_KEY_PATH }} '
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/my-app:latest
docker stop my-app || true
docker rm my-app || true
docker run --name my-app -d -p 3000:3000 --env-file /var/env/.env ${{ secrets.NCP_CONTAINER_REGISTRY }}/my-app:latest
'