-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
96 lines (84 loc) · 1.94 KB
/
.gitlab-ci.yml
File metadata and controls
96 lines (84 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
stages:
- build
- check_container
- deploy
backend-build:
stage: build
only:
- develop
- master
before_script:
- echo 'backend build starts'
- cd ./backend/ssafyBigswing/
- chmod +x ./gradlew
script:
- ./gradlew clean build
- docker build -t springboot . # Docker 이미지 빌드
# artifacts:
# name: "springboot"
# paths:
# - ./backend/ssafyBigswing/build/libs/*.jar
# tags:
# - ssafy
frontend-build:
stage: build
only:
- develop
- master
before_script:
- echo 'frontend build starts'
- cd ./frontend
script:
- docker build -t nextjs -f ./Dockerfile . # Docker 이미지 빌드
# # artifacts:
# # name: "nextjs"
# # paths:
# # - ./frontend/.next/
# # tags:
# # - ssafy
frontend-check-container:
stage: check_container
only:
- master
script:
- |
if docker ps -a --format '{{.Names}}' | grep -q "nextjs-app"; then
echo "The 'nextjs-app' container already exists."
docker stop nextjs-app # 컨테이너 중지
docker rm nextjs-app # 컨테이너 삭제
fi
tags:
- ssafy
backend-check-container:
stage: check_container
only:
- master
script:
- |
if docker ps -a --format '{{.Names}}' | grep -q "springboot-app"; then
echo "The 'springboot-app' container already exists."
docker stop springboot-app # 컨테이너 중지
docker rm springboot-app # 컨테이너 삭제
fi
tags:
- ssafy
backend-deploy:
stage: deploy
only:
- master
before_script:
- echo 'backend deploy starts'
script:
- docker run -d -p 8080:8080 --name springboot-app springboot # Docker 컨테이너 실행
tags:
- ssafy
frontend-deploy:
stage: deploy
only:
- master
before_script:
- echo "frontend deploy start"
script:
- sudo docker run -d -p 3000:3000 --name nextjs-app nextjs # Docker 컨테이너 실행
tags:
- ssafy