This repository was archived by the owner on Jan 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcloudbuild.yaml
67 lines (65 loc) · 2.04 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
steps:
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim"
id: "setup-envs"
entrypoint: "bash"
args:
- "-c"
- |
printf "%s" "$$APP_ENGINE_ENVS" > ./env.sh
printf "%s" "$$DJANGO_STORAGES_GCS_KEY" > ./django-storages-gcs-key.json
chmod +x ./env.sh
secretEnv: ["APP_ENGINE_ENVS", "DJANGO_STORAGES_GCS_KEY"]
waitFor: ["-"]
- name: "python:3.8-slim-buster"
id: "install-deps"
entrypoint: "python3"
args: ["-m", "pip", "install", "-r", "requirements.txt", "--user"]
waitFor: [ "-" ]
- name: "python:3.8-slim-buster"
id: "collect-statics"
entrypoint: "bash"
args:
- "-c"
- |
source ./env.sh
python3 ./manage.py collectstatic --noinput
waitFor: ["setup-envs", "install-deps"]
# - name: "gcr.io/cloud-builders/wget"
# - id: "install-proxy"
# entrypoint: "bash"
# args:
# - "-c"
# - |
# wget -O /workspace/cloud_sql_proxy \
# "https://storage.googleapis.com/cloudsql-proxy/v1.19.1/cloud_sql_proxy.linux.386" \
# && chmod +x /workspace/cloud_sql_proxy
# waitFor: ["-"]
# - name: "python:3.8-slim-buster"
# id: "migrate-db"
# entrypoint: "bash"
# args:
# - "-c"
# - |
# source .env.sh
# /workspace/cloud_sql_proxy -dir=/workspace -instances=$_SQL_DB=tcp:5432 \
# & sleep 2 \
# && python3 ./manage.py makemigrations \
# && python3 ./manage.py migrate
# waitFor: ["setup-envs", "install-deps", "install-proxy"]
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim"
id: "deploy"
entrypoint: "bash"
args:
- "-c"
- |
source ./env.sh
gcloud app deploy
waitFor: ["collect-statics"]
#substitutions:
# _SQL_DB: ""
availableSecrets:
secretManager:
- versionName: "projects/anth-ja77-local-contexts-8985/secrets/APP_ENGINE_ENVS/versions/latest"
env: "APP_ENGINE_ENVS"
- versionName: "projects/anth-ja77-local-contexts-8985/secrets/django-storages-gcs-key/versions/latest"
env: "DJANGO_STORAGES_GCS_KEY"