forked from whiteblock/hobbits
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcloudbuild.yaml
26 lines (26 loc) · 919 Bytes
/
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
# https://cloud.google.com/cloud-build/docs/speeding-up-builds
# https://cloud.google.com/cloud-build/docs/configuring-builds/substitute-variable-values
substitutions:
_IMAGE: 'gcr.io/whiteblock/hobbits'
timeout: '30m'
steps:
# allow these steps to fail, they try to pull cache first
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull $_IMAGE:$BRANCH_NAME || true' ]
# build final docker image
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', '$_IMAGE:$BRANCH_NAME',
'-t', '$_IMAGE:$COMMIT_SHA',
'--cache-from', '$_IMAGE:$BRANCH_NAME',
'.'
]
# push docker image tag(s) one branch, one immutable
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_IMAGE:$COMMIT_SHA' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_IMAGE:$BRANCH_NAME' ]
options:
machineType: 'N1_HIGHCPU_8'