-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
49 lines (44 loc) · 1.27 KB
/
cloudbuild.yaml
File metadata and controls
49 lines (44 loc) · 1.27 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
steps:
# Step 1: Fetch the .env file from Secret Manager
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: 'Fetch .env from Secret Manager'
entrypoint: 'sh'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=SIMPLE_NEST_ENV > /workspace/.env
# Step 2: Build the Docker image
- name: 'gcr.io/cloud-builders/docker'
id: 'Build Docker Image'
args:
[
'build',
'-t',
'gcr.io/$PROJECT_ID/nest-simple-api:$COMMIT_SHA',
'.',
]
# Step 3: Push the Docker image to Google Container Registry
- name: 'gcr.io/cloud-builders/docker'
id: 'Push Docker Image'
args:
[
'push',
'gcr.io/$PROJECT_ID/nest-simple-api:$COMMIT_SHA',
]
# Step 4: Deploy to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
id: 'Deploy to Cloud Run'
entrypoint: 'sh'
args:
- '-c'
- |
gcloud run deploy nest-simple-api \
--image gcr.io/$PROJECT_ID/nest-simple-api:$COMMIT_SHA \
--region us-central1 \
--cpu 1 \
--memory 1024Mi \
--allow-unauthenticated
images:
- 'gcr.io/$PROJECT_ID/nest-simple-api:$COMMIT_SHA'
# Optional: Specify a log bucket for build logs
logsBucket: 'gs://mlwspace-bucket/logs'