This repository was archived by the owner on Aug 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (144 loc) · 3.96 KB
/
Makefile
File metadata and controls
176 lines (144 loc) · 3.96 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# =======================================================
# Variables
# =======================================================
TERRAFORM_CONTAINER=hashicorp/terraform:0.9.2
NODE_CONTAINER=node:6.11.0
region ?= eu-west-2
env ?= dev
app_name ?= serverless
# =======================================================
# Local Targets
# =======================================================
create-cert:
docker run --rm -it\
-v `pwd`/infrastructure/local/pki/:/etc/ssl/private/\
-v `pwd`/scripts/generate_cert:/generate\
$(NODE_CONTAINER)\
/bin/sh -c "/bin/sh generate serverless.iwc.dev"
init: init-client init-lambdas init-local-api
build: build-client
test: test-client
lint: lint-client
init-local-api:
docker run --rm\
-w /api\
-v `pwd`/infrastructure/local/api:/api\
$(NODE_CONTAINER)\
/bin/sh -c "npm install"
# =======================================================
# Infrastructure Targets
# =======================================================
terraform-init:
docker run -it\
--entrypoint "/bin/sh"\
-v `pwd`/infrastructure:/infrastructure\
-v `pwd`/scripts/terraform_init:/scripts/terraform_init\
-w /infrastructure\
-e "ENV=$(env)"\
$(TERRAFORM_CONTAINER)\
/scripts/terraform_init
terraform-validate:
docker run --rm\
--entrypoint "/bin/sh"\
-v `pwd`/infrastructure:/infrastructure\
-v `pwd`/scripts/terraform_validate:/scripts/terraform_validate\
-w /infrastructure\
-e "ENV=$(env)"\
$(TERRAFORM_CONTAINER)\
/scripts/terraform_validate
terraform-plan:
docker run --rm\
--entrypoint "/bin/sh"\
-v `pwd`/infrastructure:/infrastructure\
-v `pwd`/scripts/terraform_plan:/scripts/terraform_plan\
-w /infrastructure\
-e "ENV=$(env)"\
$(TERRAFORM_CONTAINER)\
/scripts/terraform_plan
terraform-apply:
docker run --rm\
--entrypoint "/bin/sh"\
-v `pwd`/infrastructure:/infrastructure\
-v `pwd`/scripts/terraform_apply:/scripts/terraform_apply\
-w /infrastructure\
-e "ENV=$(env)"\
$(TERRAFORM_CONTAINER)\
/scripts/terraform_apply
terraform-destroy:
docker run -it\
--entrypoint "/bin/sh"\
-v `pwd`/infrastructure:/infrastructure\
-v `pwd`/scripts/terraform_destroy:/scripts/terraform_destroy\
-w /infrastructure\
-e "ENV=$(env)"\
$(TERRAFORM_CONTAINER)\
/scripts/terraform_destroy
# =======================================================
# Continuous Integration Targets
# =======================================================
ci-init: init-client init-lambdas
ci-build:
docker run --rm\
-w /client\
-v `pwd`/src/client:/client\
$(NODE_CONTAINER)\
/bin/sh -c "npm run build-prod"
ci-publish-site:
docker run --rm\
--entrypoint "/bin/sh"
-w /scripts\
-v `pwd`/scripts:/scripts
-v `pwd`/src/client:/client\
-e "ENV=$(env)"\
-e "REGION=$(region)"\
-e "APP_NAME=$(app_name)"\
$(NODE_CONTAINER)\
publish_site
ci-publish-lambdas:
docker run --rm\
--entrypoint "/bin/sh"
-w /scripts\
-v `pwd`/scripts:/scripts\
-v `pwd`/src/lambdas:/lambdas\
-e "ENV=$(env)"\
-e "REGION=$(region)"\
-e "APP_NAME=$(app_name)"\
$(NODE_CONTAINER)\
publish_lambdas
# =======================================================
# Client Targets
# =======================================================
init-client:
docker run --rm\
-w /client\
-v `pwd`/src/client:/client\
$(NODE_CONTAINER)\
/bin/sh -c "npm install"
build-client:
docker run --rm\
-w /client\
-v `pwd`/src/client:/client\
$(NODE_CONTAINER)\
/bin/sh -c "npm run build-dev"
test-client:
docker run --rm\
-w /client\
-v `pwd`/src/client:/client\
$(NODE_CONTAINER)\
/bin/sh -c "npm test"
lint-client:
docker run --rm\
-w /client\
-v `pwd`/src/client:/client\
$(NODE_CONTAINER)\
/bin/sh -c "npm run lint"
# =======================================================
# Lambda Targets
# =======================================================
init-lambdas: init-processor
init-processor:
docker run --rm\
-w /processor\
-v `pwd`/src/lambdas/processor:/processor\
$(NODE_CONTAINER)\
/bin/sh -c "npm install"