-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yml
78 lines (72 loc) · 1.93 KB
/
cloudbuild.yml
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
steps:
- id: build-backend
name: 'docker'
args:
- build
- --file=Dockerfile
- '--tag=$_ARTIFACT_REPOSITORY_IMAGE_NAME:$SHORT_SHA'
- '--tag=$_ARTIFACT_REPOSITORY_IMAGE_NAME:latest'
- --cache-from=$_ARTIFACT_REPOSITORY_IMAGE_NAME:latest
- .
dir: '.'
- id: push-backend
name: 'docker'
args:
- push
- --all-tags
- $_ARTIFACT_REPOSITORY_IMAGE_NAME
dir: '.'
waitFor: ['build-backend']
- name: 'node'
entrypoint: 'npm'
args: ['install']
- name: 'node'
entrypoint: 'npm'
args: ['run', 'build']
- name: 'node'
id: 'apply-migrations'
entrypoint: 'npx'
args: ['prisma', 'migrate', 'deploy']
secretEnv: ['DATABASE_URL']
dir: '.'
waitFor: ['push-backend']
- id: deploy-backend
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- run
- deploy
- graphql-nestjs-backend
- --quiet
- --platform=managed
- --project=$PROJECT_ID
- --region=$_REGION
- --image=$_ARTIFACT_REPOSITORY_IMAGE_NAME:$SHORT_SHA
- --service-account=$_SERVICE_ACCOUNT
- --revision-suffix=$SHORT_SHA
- --tag=latest
- --concurrency=40
- --cpu=1
- --memory=512Mi
- --max-instances=3
- --min-instances=0
- --no-use-http2
- --allow-unauthenticated
- --no-cpu-throttling
- --ingress=all
- --set-env-vars=GCP_PROJECT_ID=$PROJECT_ID
- --update-secrets=DATABASE_URL=DATABASE_URL:latest
dir: "."
waitFor: ["apply-migrations"]
timeout: 2000s
substitutions:
_REGION: by-terraform
_ARTIFACT_REPOSITORY_IMAGE_NAME: by-terraform
_SERVICE_ACCOUNT: by-terraform
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/DATABASE_URL/versions/latest
env: DATABASE_URL
# ビルド結果に生成したイメージ情報を表示する
images:
- $_ARTIFACT_REPOSITORY_IMAGE_NAME:$SHORT_SHA