-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
57 lines (52 loc) · 1.74 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
57 lines (52 loc) · 1.74 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
steps:
# Build and push backend image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/notation-backend', './backend']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/notation-backend']
# Deploy backend to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
id: 'deploy-backend'
args:
- 'run'
- 'deploy'
- 'notation-backend'
- '--image'
- 'gcr.io/$PROJECT_ID/notation-backend'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
- '--set-env-vars'
- 'RAILS_ENV=production,RAILS_LOG_TO_STDOUT=true,RAILS_SERVE_STATIC_FILES=true'
- '--set-secrets'
- 'RAILS_MASTER_KEY=rails-master-key:latest,GEMINI_API_KEY=gemini-api-key:latest'
# Get backend URL and Build/Push frontend image
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
BACKEND_URL=$(gcloud run services describe notation-backend --platform managed --region us-central1 --format 'value(status.url)')
docker build -t gcr.io/$PROJECT_ID/notation-frontend --build-arg VITE_BACKEND_URL=$$BACKEND_URL ./frontend
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/notation-frontend']
# Deploy frontend to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- 'notation-frontend'
- '--image'
- 'gcr.io/$PROJECT_ID/notation-frontend'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
images:
- 'gcr.io/$PROJECT_ID/notation-backend'
- 'gcr.io/$PROJECT_ID/notation-frontend'
options:
logging: CLOUD_LOGGING_ONLY