-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloudbuild.yaml
53 lines (45 loc) · 1.47 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
45
46
47
48
49
50
51
52
53
# [START cloudrun_rails_cloudbuild]
steps:
- id: "build image"
name: "gcr.io/cloud-builders/docker"
entrypoint: 'bash'
args: ["-c", "docker build -t gcr.io/${PROJECT_ID}/${_SERVICE_NAME} . "]
secretEnv: ["RAILS_KEY"]
- id: "push image"
name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/${PROJECT_ID}/${_SERVICE_NAME}"]
- id: "apply migrations"
name: "gcr.io/google-appengine/exec-wrapper"
entrypoint: "bash"
args:
[
"-c",
"/buildstep/execute.sh -i gcr.io/${PROJECT_ID}/${_SERVICE_NAME} -s ${PROJECT_ID}:${_REGION}:${_INSTANCE_NAME} -- bundle exec rake db:migrate"
]
secretEnv: ["RAILS_KEY"]
- id: "run deploy"
name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: gcloud
args:
[
"run", "deploy",
"${_SERVICE_NAME}",
"--platform", "managed",
"--region", "${_REGION}",
"--image", "gcr.io/${PROJECT_ID}/${_SERVICE_NAME}",
"--add-cloudsql-instances", "missing-persons-app-team12:asia-southeast1:missing-database",
"--allow-unauthenticated"
]
secretEnv: ["RAILS_KEY"]
substitutions:
_REGION: asia-southeast1
_SERVICE_NAME: missing
_INSTANCE_NAME: missing-database
_SECRET_NAME: RAILS_SECRET_NAME
availableSecrets:
secretManager:
- versionName: projects/${PROJECT_ID}/secrets/${_SECRET_NAME}/versions/latest
env: RAILS_KEY
images:
- "gcr.io/${PROJECT_ID}/${_SERVICE_NAME}"
# [END cloudrun_rails_cloudbuild]