forked from shubha-rajan/cloudbuild-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
69 lines (60 loc) · 1.6 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
steps:
# install dependencies for frontend app
- id: yarn-install
name: node
entrypoint: yarn
args: ['install']
dir: 'frontend'
wait_for: ['-']
# build frontend app with webpack
- id: yarn-build
name: node
entrypoint: yarn
dir: 'frontend'
args: ['run', 'build']
wait_for: ['yarn-install']
- name: 'gcr.io/cloud-builders/gsutil'
args: [ 'cp', 'frontend/*.html', 'gs://${_BUCKET_NAME}']
wait_for: ['-']
# Build the container image for api
- id: docker-build
name: 'gcr.io/cloud-builders/docker'
dir: 'api'
args: ['build', '-t', 'gcr.io/${_PROJECT_ID}/cloudcatsapi', '.']
wait_for: ['-']
# Use the container image to run tests
# - name: 'gcr.io/cloud-builders/docker'
# entrypoint: 'bash'
# args: ['-c', 'docker run gcr.io/${_PROJECT_ID}/cloudcatsapi pytest -v']
# Push the container image to Container Registry
- id: gcr-push
name: 'gcr.io/cloud-builders/docker'
dir: 'api'
args: ['push', 'gcr.io/${_PROJECT_ID}/cloudcatsapi']
wait_for: ['docker-build']
# Deploy container image to Cloud Run
- id: cloud-run
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
dir: 'api'
entrypoint: gcloud
args: [
'run',
'deploy',
'cloudcatsapi',
'--image',
'gcr.io/${_PROJECT_ID}/cloudcatsapi',
'--region',
'us-central1',
'--platform',
'managed',
'--allow-unauthenticated'
]
wait_for: ['gcr-push']
images:
- gcr.io/${_PROJECT_ID}/cloudcatsapi
artifacts:
objects:
location: "gs://${_BUCKET_NAME}/dist"
paths: [
'frontend/dist/*',
]