Skip to content

Commit

Permalink
deploy: build and scp frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxoxo committed Dec 10, 2023
1 parent 7502da5 commit 21b9dcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
43 changes: 13 additions & 30 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push frontend
name: Build and Scp frontend

on:
push:
Expand All @@ -15,41 +15,24 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y curl
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Login to NCP Container Registry
uses: docker/login-action@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry: byeolsoop-registry.kr.ncr.ntruss.com
username: ${{ secrets.API_ACCESS_KEY }}
password: ${{ secrets.API_SECRET_KEY }}
node-version: "20.10.0"

- name: Build and Push Frontend Docker Image
- name: Install Dependencies and Build
run: |
docker build -t byeolsoop-registry.kr.ncr.ntruss.com/frontend:byeolsoop -f ./docker/fe/Dockerfile .
docker push byeolsoop-registry.kr.ncr.ntruss.com/frontend:byeolsoop
cd ./FE
echo ${{secrets.ENV_FE}} > .env
npm install --force
npm run build
pull-and-deploy:
runs-on: ubuntu-20.04
needs: build-and-push-frontend

steps:
- name: SSH-deploy
uses: appleboy/ssh-action@master
- name: Deploy to NCloud
uses: appleboy/scp-action@master
with:
host: ${{secrets.VPC_HOST}}
username: ${{secrets.VPC_USER}}
password: ${{secrets.VPC_PASSWORD}}
port: ${{secrets.VPC_PORT}}
script: |
cd /home/docker-byeolsoop/srcs
docker system prune -f
docker pull byeolsoop-registry.kr.ncr.ntruss.com/frontend:byeolsoop
docker compose up --force-recreate -d 2>log.out
cat log.out
source: "./FE/build/*"
target: "/home/docker-byeolsoop/data/www"
2 changes: 2 additions & 0 deletions docker/fe/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 정적 파일 서빙방식으로 변경하면서 사용하지 않음

FROM node:20.10.0-alpine3.18

LABEL author jeongmin
Expand Down

0 comments on commit 21b9dcc

Please sign in to comment.