-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
52 lines (45 loc) · 1.38 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
steps:
# pull cache
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: [ '-c', 'docker pull $_GCR_IMAGE_PATH || exit 0' ]
id: 'pull-server'
waitFor: [ '-' ]
# build
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', '$_GCR_IMAGE_PATH:$TAG_NAME',
'-t', '$_GCR_IMAGE_PATH',
'--cache-from', '$_GCR_IMAGE_PATH',
'--build-arg', 'BUILDKIT_INLINE_CACHE=1',
'--build-arg', 'VERSION=$TAG_NAME',
'--file', './server/Dockerfile', '.' ]
id: 'build-server'
waitFor:
- 'pull-server'
env:
- 'DOCKER_BUILDKIT=1'
# save
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_GCR_IMAGE_PATH:$TAG_NAME' ]
id: 'save-server-tag'
waitFor:
- 'build-server'
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_GCR_IMAGE_PATH' ]
id: 'save-server-latest'
waitFor:
- 'build-server'
# deploy
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args: ['run', 'deploy', '$_CLOUD_RUN_NAME', '--image', '$_GCR_IMAGE_PATH:$TAG_NAME', '--region', '$_CLOUD_RUN_REGION', '--update-env-vars', 'REACT_APP_FRAME_ONE_PLACEHOLDER_VERSION=$TAG_NAME']
id: 'deploy-server'
waitFor:
- 'save-server-tag'
images:
- $_GCR_IMAGE_PATH:$TAG_NAME
- $_GCR_IMAGE_PATH
options:
env:
- 'DOCKER_BUILDKIT=1'
timeout: 300s