File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - dev
7+ - feat/cicd
78
89jobs :
910 build :
2324
2425 - name : Run build
2526 run : npm run build # 또는 프로젝트에 맞는 빌드 명령어
27+
28+ - name : Docker build & push
29+ run : |
30+ docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
31+ docker build -t ${{ secrets.DOCKER_USERNAME }}/embitips_front .
32+ docker push ${{ secrets.DOCKER_USERNAME }}/embitips_front
33+
34+ - name : Deploy to GCP
35+ uses : appleboy/ssh-action@master
36+ with :
37+ host : ${{ secrets.HOST_PROD }}
38+ username : ${{ secrets.USERNAME }}
39+ key : ${{ secrets.PRIVATE_KEY }}
40+ script : |
41+ sudo docker stop embitips_front || true
42+ sudo docker rm embitips_front || true
43+ sudo docker pull ${{ secrets.DOCKER_USERNAME }}/embitips_front
44+ sudo docker run -d -p 80:80 --name embitips_front ${{ secrets.DOCKER_USERNAME }}/embitips_front
45+ sudo docker image prune -f
Original file line number Diff line number Diff line change 1+ # 1. Node.js 환경에서 빌드
2+ FROM node:18 as build
3+ WORKDIR /app
4+ COPY package.json ./
5+ RUN npm install
6+ COPY . ./
7+ RUN npm run build
8+
9+ # 2. Nginx를 사용해 정적 파일 서빙
10+ FROM nginx:latest
11+ COPY --from=build /app/build /usr/share/nginx/html
12+ COPY nginx.conf /etc/nginx/conf.d/default.conf
13+
14+ EXPOSE 80
15+ CMD ["nginx" , "-g" , "daemon off;" ]
You can’t perform that action at this time.
0 commit comments