generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
237 lines (237 loc) · 6.73 KB
/
cloudbuild.yaml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#Question Service
steps:
# Step 1: Create the .env file in backend/question_service
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=question_service > backend/question_service/.env
# Step 2: Install dependencies
- name: 'node:18'
entrypoint: 'npm'
args:
- 'install'
- '--prefix'
- '.'
dir: 'backend/question_service'
# Step 3: Run tests
- name: 'node:18'
entrypoint: 'npm'
args:
- 'test'
dir: 'backend/question_service'
# Step 4: Build your Docker image in backend/question_service
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/question_service'
- ./backend/question_service
# Step 5: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm backend/question_service/.env
# Step 6: Push question_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/question_service:latest'
# Matching Service
# Step 1: Create the .env file in backend/matching_service/
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=matching_service > backend/matching_service/.env
# Step 2: Install dependencies
- name: 'node:18'
entrypoint: 'npm'
args:
- 'install'
- '--prefix'
- '.'
dir: 'backend/matching_service'
# Step 3: Run tests
- name: 'node:18'
entrypoint: 'npm'
args:
- 'test'
dir: 'backend/matching_service'
# Step 4: Build your Docker image in backend/matching_service
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/matching_service'
- ./backend/matching_service
# Add any other Docker build options as needed.
# Step 5: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm backend/matching_service/.env
# Step 6: Push matching_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/matching_service:latest'
#User Service
# Step 1: Create the .env file in backend/user_service/
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=user_service > backend/user_service/.env
# Add any additional steps to modify or process the .env file as needed.
# Step 2: Install dependencies
- name: 'node:18'
entrypoint: 'npm'
args:
- 'install'
- '--prefix'
- '.'
dir: 'backend/user_service'
# Step 3: Run tests
- name: 'node:18'
entrypoint: 'npm'
args:
- 'test'
dir: 'backend/user_service'
# Step 4: Build your Docker image in backend/user_service
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/user_service'
- ./backend/user_service
# Step 5: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm backend/user_service/.env
# Step 6: Push user_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/user_service:latest'
#Room Service
# Step 1: Create the .env file in backend/room_service/
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=room_service > backend/room_service/.env
# Add any additional steps to modify or process the .env file as needed.
# Step 2: Install dependencies
- name: 'node:18'
entrypoint: 'npm'
args:
- 'install'
- '--prefix'
- '.'
dir: 'backend/room_service'
# Step 3: Build your Docker image in backend/room_service
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/room_service'
- ./backend/room_service
# Step 4: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm backend/room_service/.env
# Step 5: Push room_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/room_service:latest'
#Video Token Service
# Step 1: Create the .env file in backend/video_token_service/
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=video_token_service > backend/video_token_service/.env
# Add any additional steps to modify or process the .env file as needed.
# Step 2: Install dependencies
- name: 'node:18'
entrypoint: 'npm'
args:
- 'install'
- '--prefix'
- '.'
dir: 'backend/video_token_service'
# Step 3: Build your Docker image in backend/video_token_service
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/video_token_service'
- ./backend/video_token_service
# Step 4: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm backend/video_token_service/.env
# Step 5: Push video_token_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/video_token_service:latest'
# Frontend service
# Step 1: Create the .env file in /frontend
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=frontend_service > frontend/.env
# Add any additional steps to modify or process the .env file as needed.
# Step 2: Build your Docker image in /frontend
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/frontend_service'
- ./frontend
# Step 3: Delete the .env file
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
rm frontend/.env
# Step 4: Push frontend_service image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/frontend_service:latest'
# Trigger update of images in deployed to GKE
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
if [ "$?" -eq 0 ]; then
gcloud pubsub topics publish projects/thinking-return-402109/topics/update-images --message "Build steps completed successfully."
else
echo "Build steps failed, not publishing Pub/Sub message."
fi