-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
61 lines (54 loc) · 1.83 KB
/
cloudbuild.yaml
File metadata and controls
61 lines (54 loc) · 1.83 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
# Cloud Build configuration for sevorix-hub
# Builds and deploys to Cloud Run
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub:${SHORT_SHA}'
- '-t'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub:latest'
- '-f'
- 'sevorix-hub/Dockerfile'
- '.'
id: 'build-image'
# Push to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- '--all-tags'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub'
id: 'push-image'
waitFor: ['build-image']
# Deploy to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'sevorix-hub'
- '--image=${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub:${SHORT_SHA}'
- '--region=${_REGION}'
- '--platform=managed'
- '--service-account=sevorix-hub@${PROJECT_ID}.iam.gserviceaccount.com'
- '--set-env-vars=STORAGE_BACKEND=gcs,GCS_BUCKET=${PROJECT_ID}-artifacts'
- '--set-secrets=DATABASE_URL=sevorix-hub-database-url:latest,JWT_SECRET=sevorix-hub-jwt-secret:latest'
- '--add-cloudsql-instances=${PROJECT_ID}:${_REGION}:sevorix-hub-db'
- '--vpc-connector=sevorix-hub-connector'
- '--allow-unauthenticated'
id: 'deploy-service'
waitFor: ['push-image']
# Default substitutions
substitutions:
_REGION: us-central1
# Store images in Artifact Registry
images:
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub:${SHORT_SHA}'
- '${_REGION}-docker.pkg.dev/${PROJECT_ID}/sevorix-hub/sevorix-hub:latest'
# Build options
options:
logging: CLOUD_LOGGING_ONLY
machineType: 'E2_HIGHCPU_8'
# Timeout
timeout: '1200s'