generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
cloudbuild.yaml
89 lines (77 loc) · 2.92 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
steps:
# Build the user-service
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/user-service:$COMMIT_SHA',
'-f', './user-service/Dockerfile.prod',
'./user-service']
# Push the user-service image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/user-service:$COMMIT_SHA']
# Deploy the user-service to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '${_USR_CLOUD_RUN_NAME}',
'--image', 'gcr.io/$PROJECT_ID/user-service:$COMMIT_SHA',
'--region', '${_REGION}',
'--port', '${_USER_PORT}',
"--allow-unauthenticated"
]
# Build the question-service
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/question-service:$COMMIT_SHA',
'-f', './question-service/Dockerfile.prod',
'./question-service']
# Push the question-service image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/question-service:$COMMIT_SHA']
# Deploy question-service
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '${_QN_CLOUD_RUN_NAME}',
'--image', 'gcr.io/$PROJECT_ID/question-service:$COMMIT_SHA',
'--region', '${_REGION}',
'--port', '${_QN_PORT}',
"--allow-unauthenticated"
]
# Build matching-service
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/matching-service:$COMMIT_SHA',
'-f', './matching-service/Dockerfile.prod',
'./matching-service']
# Push the matching-service image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/matching-service:$COMMIT_SHA']
# Deploy matching-service
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '${_MS_CLOUD_RUN_NAME}',
'--image', 'gcr.io/$PROJECT_ID/matching-service:$COMMIT_SHA',
'--region', '${_REGION}',
'--port', '${_MS_PORT}',
"--allow-unauthenticated"
]
# Build the frontend service
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/frontend-service:$COMMIT_SHA',
# specifiy which dockerfile to use
'-f', './frontend/Dockerfile.prod',
'./frontend'
]
# Push the frontend-service image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/frontend-service:$COMMIT_SHA']
# Deploy frontend-service
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '${_FE_CLOUD_RUN_NAME}',
'--image', 'gcr.io/$PROJECT_ID/frontend-service:$COMMIT_SHA',
'--region', '${_REGION}',
'--port', '${_FE_PORT}',
"--allow-unauthenticated"
]
# Images to store in Container Registry
images:
- 'gcr.io/$PROJECT_ID/user-service:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/question-service:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/matching-service:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/frontend-service:$COMMIT_SHA'