-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathcloudbuild.yaml
44 lines (39 loc) · 1.33 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
# Example Cloud Build Configuration File
#
# define the build steps
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 an artifact using the docker builder
- name: "gcr.io/cloud-builders/docker"
args:
[
"build",
"--build-arg",
"NODE_ENV=production",
"-t",
"${_GCR_REGION}.gcr.io/$PROJECT_ID/$REPO_NAME:$SHORT_SHA",
".",
]
# push the artifact to a GCR repository
- name: "gcr.io/cloud-builders/docker"
args: ["push", "${_GCR_REGION}.gcr.io/$PROJECT_ID/$REPO_NAME:$SHORT_SHA"]
# deploy the app to a GKE cluster using the `gke-deploy` builder and expose it
# using a load balancer on port 80.
# https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gke-deploy
- name: "gcr.io/cloud-builders/gke-deploy"
args:
- run
- --image=${_GCR_REGION}.gcr.io/$PROJECT_ID/$REPO_NAME:$SHORT_SHA
- --location=${_GKE_CLUSTER_LOCATION}
- --cluster=${_GKE_CLUSTER_NAME}
- --project=${_GKE_CLUSTER_PROJECT}
- --expose=80
substitutions:
_GCR_REGION: eu # must be substituted
_GKE_CLUSTER_LOCATION: europe-west3 # must be substituted
_GKE_CLUSTER_NAME: private-cluster # must be substituted