-
Notifications
You must be signed in to change notification settings - Fork 2
/
cloudbuild.yaml
28 lines (28 loc) · 1.05 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
# 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/binance/dexter-data'
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 docker image
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', '$_IMAGE:latest',
'-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:latest' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_IMAGE:$COMMIT_SHA' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '$_IMAGE:$BRANCH_NAME' ]
images: [ '$_IMAGE:latest', '$_IMAGE:$COMMIT_SHA', '$_IMAGE:$BRANCH_NAME' ]