Repository navigation
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
61 lines (54 loc) · 1.58 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
61 lines (54 loc) · 1.58 KB
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
53
54
55
56
57
58
59
60
61
steps:
# 0. Pull previous latest image for layer caching (ignore if first build)
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
- "-c"
- "docker pull gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest || exit 0"
# 1. Build Docker container image using cached layers
- name: "gcr.io/cloud-builders/docker"
args:
- "build"
- "--cache-from"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest"
- "-t"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"
- "-t"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest"
- "."
# 2. Push images to Container Registry
- name: "gcr.io/cloud-builders/docker"
args:
- "push"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"
- name: "gcr.io/cloud-builders/docker"
args:
- "push"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest"
# 3. Deploy new revision to Cloud Run using the lightweight :slim SDK image
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim"
entrypoint: gcloud
args:
- "run"
- "deploy"
- "${_SERVICE_NAME}"
- "--image"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"
- "--region"
- "${_REGION}"
- "--platform"
- "managed"
- "--allow-unauthenticated"
- "--no-cpu-throttling"
- "--min-instances"
- "0"
- "--port"
- "8080"
images:
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$COMMIT_SHA"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest"
substitutions:
_SERVICE_NAME: "patchpilot"
_REGION: "europe-west1"
options:
logging: CLOUD_LOGGING_ONLY