-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
70 lines (63 loc) · 1.99 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
70 lines (63 loc) · 1.99 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
62
63
64
65
66
67
68
69
70
# Google Cloud Build configuration for CancerAg Inference App
# This file automates building and deploying to Cloud Run
steps:
# Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-f'
- 'inference_app/Dockerfile'
- '-t'
- 'gcr.io/$PROJECT_ID/cancerag-inference:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/cancerag-inference:latest'
- '.'
timeout: 1800s # 30 minutes for building (model files are large)
# Push the image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/cancerag-inference:$COMMIT_SHA'
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/cancerag-inference:latest'
# Deploy to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'cancerag-inference'
- '--image'
- 'gcr.io/$PROJECT_ID/cancerag-inference:$COMMIT_SHA'
- '--region'
- 'us-central1' # Change to your preferred region
- '--platform'
- 'managed'
- '--allow-unauthenticated' # Makes the service publicly accessible
- '--memory'
- '4Gi' # 4GB RAM (needed for docking)
- '--cpu'
- '2' # 2 vCPUs for better performance
- '--timeout'
- '3600' # 1 hour timeout (for slow docking operations)
- '--concurrency'
- '80' # Max concurrent requests per instance
- '--max-instances'
- '10' # Max number of instances
- '--min-instances'
- '0' # Scale to zero when idle (saves cost)
- '--port'
- '8080'
# Build timeout (total time allowed for all steps)
timeout: 3600s
# Image to store
images:
- 'gcr.io/$PROJECT_ID/cancerag-inference:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/cancerag-inference:latest'
# Build options
options:
machineType: 'E2_HIGHCPU_8' # Use powerful machine for faster builds
diskSizeGb: 100
logging: CLOUD_LOGGING_ONLY