-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
51 lines (51 loc) · 1.62 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
steps:
# Buil and deploy frontend
- name: 'node:13.7.0'
dir: ./frontend
entrypoint: npm
args: ['install']
- name: 'node:13.7.0'
dir: ./frontend
entrypoint: npm
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gcloud'
dir: ./frontend
args: ['app', 'deploy', 'frontend.yaml']
# Deploy backend
- name: 'python:3.7'
entrypoint: bash
dir: ./backend
env:
- 'GOOGLE_CLOUD_PROJECT=$PROJECT_ID'
args:
- -c
- |
pip install pipenv &&
pipenv lock -r > requirements.txt &&
pipenv install &&
pipenv run python manage.py collectstatic --noinput
- name: 'gcr.io/cloud-builders/gcloud'
dir: ./backend
args: ['app', 'deploy', 'backend.yaml']
# Deploy dispatcher
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'dispatch.yaml']
# Deploy cloud function (first retrieve the cloud function password)
- name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
args: [ '-c', "gcloud secrets versions access latest --secret=CLOUD_FUNCTION_PASSWORD --format='get(payload.data)' | tr '_-' '/+' | base64 -d > password.txt" ]
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- -c
- |
gcloud functions deploy processing \
--region europe-west1 \
--entry-point main \
--runtime python37 \
--trigger-resource circular-fusion-290809.appspot.com \
--trigger-event google.storage.object.finalize \
--source backend/functions/processing \
--set-env-vars CLOUD_FUNCTION_EMAIL=circular-fusion-290809@appspot.gserviceaccount.com,GOOGLE_CLOUD_HOST_URL=circular-fusion-290809.ew.r.appspot.com,CLOUD_FUNCTION_PASSWORD=$(cat password.txt) \
--memory=1024
timeout: '1600s'