-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
44 lines (44 loc) · 1.24 KB
/
cloudbuild.yaml
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
steps:
- id: Get Env File
name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
args:
- '-c'
- "gcloud secrets versions access latest --secret=$_ENV_FILE_SECRET_NAME --format='get(payload.data)' | tr '_-' '/+' | base64 -d > /workspace/.env.production"
- id: Build Image
name: gcr.io/cloud-builders/docker
dir: /workspace
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- '.'
- id: Push Image
name: gcr.io/cloud-builders/docker
args:
- 'push'
- 'gcr.io/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- id: Deploy
name: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
entrypoint: gcloud
args:
- run
- deploy
- $_SERVICE_NAME
- '--image=gcr.io/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- '--platform=managed'
- '--region=$_DEPLOY_REGION'
- '--port=3000'
- '--quiet'
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
options:
substitutionOption: ALLOW_LOOSE
logging: CLOUD_LOGGING_ONLY
substitutions:
_SERVICE_NAME: vote-service
_DEPLOY_REGION: us-central1
_ENV_FILE_SECRET_NAME: vote-service-env
tags:
- storefront-service-v2
timeout: 1800s