-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
119 lines (94 loc) · 2.77 KB
/
Makefile
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
path ?= $(shell pwd)
grant ?= ${path}/grant.zip
tfstate ?= terraform.tfstate
tfplan ?= terraform.tfplan
app ?= grant
os_type ?= linux
region ?= westus2
image ?= grant-oauth
subscription_id ?= ...
tenant_id ?= ...
client_id ?= ...
client_secret ?= ...
user ?= ...
pass ?= ...
firebase_path ?= ...
firebase_auth ?= ...
example ?= transport-state
# -----------------------------------------------------------------------------
# Develop
build-dev:
cd ${path}/examples/${example} && \
rm -rf node_modules && \
npm install --production && \
docker build -t ${image} .
run-dev:
cd ${path}/examples/${example} && \
docker run -p 3000:80 ${image}
# -----------------------------------------------------------------------------
# Build
build-grant:
rm -f ${grant}
cd ${path}/examples/${example} && \
rm -rf node_modules && \
npm install --production && \
zip -r ${grant} grant host.json proxies.json package.json store.js
build-callback:
rm -f ${grant}
cd ${path}/examples/${example} && \
rm -rf node_modules && \
npm install --production && \
zip -r ${grant} grant hello hi host.json proxies.json package.json store.js
# -----------------------------------------------------------------------------
# Deploy
token = $(shell echo -n "\$$${user}:${pass}" | base64 -w 0)
auth = Authorization: Basic ${token}
deploy_url = https://${app}.scm.azurewebsites.net/api/zipdeploy
deploy:
curl -X POST ${deploy_url} --header "${auth}" --data-binary @"${grant}"
# -----------------------------------------------------------------------------
# Terraform
init:
cd ${path}/terraform/ && \
terraform init
plan:
cd ${path}/terraform/ && \
TF_VAR_app=${app} \
TF_VAR_region=${region} \
TF_VAR_os_type=${os_type} \
TF_VAR_subscription_id=${subscription_id} \
TF_VAR_tenant_id=${tenant_id} \
TF_VAR_client_id=${client_id} \
TF_VAR_client_secret=${client_secret} \
TF_VAR_firebase_path=${firebase_path} \
TF_VAR_firebase_auth=${firebase_auth} \
terraform plan \
-state=${tfstate} \
-out=${tfplan}
apply:
cd ${path}/terraform/ && \
TF_VAR_app=${app} \
TF_VAR_region=${region} \
TF_VAR_os_type=${os_type} \
TF_VAR_subscription_id=${subscription_id} \
TF_VAR_tenant_id=${tenant_id} \
TF_VAR_client_id=${client_id} \
TF_VAR_client_secret=${client_secret} \
TF_VAR_firebase_path=${firebase_path} \
TF_VAR_firebase_auth=${firebase_auth} \
terraform apply \
-state=${tfstate} \
${tfplan}
destroy:
cd ${path}/terraform/ && \
TF_VAR_app=${app} \
TF_VAR_region=${region} \
TF_VAR_os_type=${os_type} \
TF_VAR_subscription_id=${subscription_id} \
TF_VAR_tenant_id=${tenant_id} \
TF_VAR_client_id=${client_id} \
TF_VAR_client_secret=${client_secret} \
TF_VAR_firebase_path=${firebase_path} \
TF_VAR_firebase_auth=${firebase_auth} \
terraform destroy \
-state=${tfstate}