-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
37 lines (31 loc) · 1.03 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
steps:
# Pull latest image to reuse as cache
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- 'docker pull gcr.io/${PROJECT_ID}/${_NAME}:latest || exit 0'
# Build container images
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t=gcr.io/${PROJECT_ID}/${_NAME}:${COMMIT_SHA}'
- '-t=gcr.io/${PROJECT_ID}/${_NAME}:latest'
- '--cache-from=gcr.io/${PROJECT_ID}/${_NAME}:latest'
- '.'
# Push container images to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/${PROJECT_ID}/${_NAME}:${COMMIT_SHA}']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/${PROJECT_ID}/${_NAME}:latest']
# Deploy container image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- '${_NAME}'
- '--image=gcr.io/${PROJECT_ID}/${_NAME}:${COMMIT_SHA}'
- '--platform=managed'
- '--port=8000'
- '--region=${_REGION}'
- '--allow-unauthenticated'