-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
83 lines (75 loc) · 2.07 KB
/
cloudbuild.yaml
File metadata and controls
83 lines (75 loc) · 2.07 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
71
72
73
74
75
76
77
78
79
80
81
82
83
# ============================================================================
# Google Cloud Build Configuration for Smart Hiring System
# Builds and deploys to Cloud Run with spaCy NLP support
# ============================================================================
steps:
# Step 1: Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:latest'
- '-f'
- 'Dockerfile.full'
- '.'
id: 'build-image'
# Step 2: Push the Docker image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:$COMMIT_SHA'
id: 'push-image'
waitFor:
- 'build-image'
# Step 3: Push latest tag
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:latest'
id: 'push-latest'
waitFor:
- 'build-image'
# Step 4: Deploy to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args:
- 'run'
- 'deploy'
- 'smart-hiring-backend'
- '--image'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:$COMMIT_SHA'
- '--region'
- '${_REGION}'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
- '--memory'
- '2Gi'
- '--cpu'
- '2'
- '--timeout'
- '300'
- '--max-instances'
- '10'
- '--min-instances'
- '0'
- '--set-env-vars'
- 'FLASK_ENV=production,PYTHONUNBUFFERED=1'
id: 'deploy-cloud-run'
waitFor:
- 'push-image'
# Substitution variables (can be overridden)
substitutions:
_REGION: 'us-central1'
# Build options
options:
logging: CLOUD_LOGGING_ONLY
machineType: 'E2_HIGHCPU_8'
# Artifacts to store
images:
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/smart-hiring-backend:latest'
# Build timeout (15 minutes for spaCy model download)
timeout: '900s'