chore : deploy.yml, Dockerfile 등록
SpecialSource Frontend CD / deploy (push) Failing after 58s

This commit is contained in:
2026-05-22 15:00:15 +09:00
parent caae9f50c6
commit 2c4b2896b7
2 changed files with 58 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
name: SpecialSource Frontend CD
on:
push:
branches: [ "master" ] # master 브랜치에 코드가 들어오면 배포 가동
jobs:
deploy:
runs-on: vue-build-runner # NAS에 심어둔 내 전용 Gitea 러너 호출
steps:
- name: 1. 소스 코드 가져오기
uses: actions/checkout@v4
- name: 2. Docker 프론트엔드 이미지 빌드
run: docker build -t ss-frontend-image .
- name: 3. 기존 컨테이너 교체 및 무중단 느낌으로 재시작
run: |
docker stop ss-frontend-container || true
docker rm ss-frontend-container || true
# 18081 포트로 개방하고, 지정하신 NAS 내부 app 디렉토리에 로그 연동
docker run -d \
--name ss-frontend-container \
-p 18081:80 \
-v /volume1/docker/app/specialsource-frontend/logs:/var/log/nginx \
ss-frontend-image
+30
View File
@@ -0,0 +1,30 @@
# 1단계: Node.js 환경에서 Vue 소스 코드를 빌드합니다.
FROM node:20-alpine AS build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# 2단계: 빌드된 결과물(HTML/JS)만 가벼운 Nginx 서버로 옮겨 담습니다.
FROM nginx:stable-alpine AS production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
# ⭐ 핵심: Vue 라우터(SPA) 지원 + 백엔드 API(18080 포트) 자동 연결 프록시 설정
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
index index.html; \
try_files $uri $uri/ /index.html; \
} \
location /api { \
proxy_pass http://192.168.0.215:18080/api; \
proxy_set_header Host $host; \
proxy_set_header X-Real-IP $remote_addr; \
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]