-
Notifications
You must be signed in to change notification settings - Fork 7
/
cloudbuild.yaml
43 lines (37 loc) · 1.16 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
steps:
# install the app dependencies
- name: "gcr.io/cloud-builders/npm"
args: ["install"]
# execute the tests
- name: "gcr.io/cloud-builders/npm"
args: ["run", "test"]
# build the container image using the docker builder
- name: "gcr.io/cloud-builders/docker"
args:
[
"build",
"--build-arg",
"NODE_ENV=production",
"-t",
"${_GCR_REGION}.gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA",
".",
]
# push the container image to Container Registry (GCR)
- name: "gcr.io/cloud-builders/docker"
args:
["push", "${_GCR_REGION}.gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"]
# Deploy the container image to Cloud Run
- name: "gcr.io/cloud-builders/gcloud"
args:
- run
- deploy
- ${_SERVICE_NAME}
- --image=${_GCR_REGION}.gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA
- --region=${_LOCATION}
- --platform=managed
images:
- "${_GCR_REGION}.gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"
substitutions:
_LOCATION: us-central1 # must be substituted
_GCR_REGION: us # must be substituted
_SERVICE_NAME: service-name # must be substituted