-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
90 lines (80 loc) · 2.17 KB
/
cloudbuild.yaml
File metadata and controls
90 lines (80 loc) · 2.17 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
84
85
86
87
88
89
90
# Google Cloud Build configuration for QCX
# This configuration builds, tests, and deploys the Docker container
steps:
# Step 1: Build the Docker image with caching
- name: 'gcr.io/cloud-builders/docker'
id: 'build-image'
args:
- 'build'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/qcx:latest'
- '--tag'
- 'gcr.io/$PROJECT_ID/qcx:$COMMIT_SHA'
- '--tag'
- 'gcr.io/$PROJECT_ID/qcx:latest'
- '--tag'
- 'gcr.io/$PROJECT_ID/qcx:$BRANCH_NAME'
- '--build-arg'
- 'BUILDKIT_INLINE_CACHE=1'
- '.'
timeout: '1200s'
# Step 2: Push the image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
id: 'push-image'
args:
- 'push'
- '--all-tags'
- 'gcr.io/$PROJECT_ID/qcx'
waitFor: ['build-image']
# Step 3: (Optional) Deploy to Cloud Run
# Uncomment and configure the following step to enable automatic deployment
# - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
# id: 'deploy-cloud-run'
# entrypoint: 'gcloud'
# args:
# - 'run'
# - 'deploy'
# - 'qcx'
# - '--image'
# - 'gcr.io/$PROJECT_ID/qcx:$COMMIT_SHA'
# - '--region'
# - 'us-central1'
# - '--platform'
# - 'managed'
# - '--allow-unauthenticated'
# - '--port'
# - '3000'
# - '--memory'
# - '2Gi'
# - '--cpu'
# - '2'
# - '--max-instances'
# - '10'
# - '--set-env-vars'
# - 'NODE_ENV=production'
# waitFor: ['push-image']
# Images to be pushed to Google Container Registry
images:
- 'gcr.io/$PROJECT_ID/qcx:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/qcx:latest'
- 'gcr.io/$PROJECT_ID/qcx:$BRANCH_NAME'
# Build options
options:
# Use high-performance machine type for faster builds
machineType: 'E2_HIGHCPU_8'
# Enable Docker layer caching
substitutionOption: 'ALLOW_LOOSE'
# Logging options
logging: 'CLOUD_LOGGING_ONLY'
# Set build timeout (20 minutes)
timeout: '1200s'
# Substitutions for environment-specific builds
substitutions:
_DEPLOY_REGION: 'us-central1'
_SERVICE_NAME: 'qcx'
# Tags for build tracking
tags:
- 'qcx'
- 'nextjs'
- 'bun'
- '${BRANCH_NAME}'