-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
83 lines (83 loc) · 2.01 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
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
79
80
81
82
83
steps:
- name: gcr.io/cloud-builders/gcloud
id: "decrypt secrets"
args:
- kms
- decrypt
- "--ciphertext-file=.env.enc"
- "--plaintext-file=.env"
- "--location=global"
- "--keyring=git-secrets"
- "--key=${_SERVICE_NAME}"
- name: gcr.io/cloud-builders/docker
id: "build container"
args:
- build
- "-t"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$SHORT_SHA"
- "."
- name: gcr.io/cloud-builders/docker
id: "tag container"
args:
- tag
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$SHORT_SHA"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:latest"
- name: gcr.io/cloud-builders/docker
id: "push container"
args:
- push
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}"
# - "--all-tags"
- id: "apply migrations"
name: "gcr.io/google-appengine/exec-wrapper"
args: [
"-i",
"gcr.io/$PROJECT_ID/${_SERVICE_NAME}",
"-s",
"${PROJECT_ID}:${_REGION}:${_INSTANCE_NAME}",
# "-e",
# "CI=True",
"--",
"python",
"manage.py",
"migrate",
]
- name: gcr.io/cloud-builders/gcloud
id: "deploy to cloud run"
args:
- run
- deploy
- ${_SERVICE_NAME}
- "--image"
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$SHORT_SHA"
- "--region"
- ${_REGION}
- "--platform"
- managed
- "--timeout"
- 10m
# This will be ran in async after build container
- id: "collect static"
name: "gcr.io/google-appengine/exec-wrapper"
args:
[
"-i",
"gcr.io/$PROJECT_ID/${_SERVICE_NAME}",
"-s",
"${PROJECT_ID}:${_REGION}:${_INSTANCE_NAME}",
"--",
"python",
"manage.py",
"collectstatic",
"--verbosity",
"2",
"--no-input",
]
waitFor:
- "build container"
substitutions:
_REGION: asia-southeast1
_SERVICE_NAME: chari-lake
_INSTANCE_NAME: iconicto
images:
- "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:$SHORT_SHA"