forked from whiteblock/genesis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
24 lines (24 loc) · 898 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
# 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/wb-genesis/bitbucket.org/whiteblockio/genesis'
timeout: '300s'
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' ]