-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
44 lines (33 loc) · 2.41 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
.PHONY: dist validate clean
bucket = ${CODE_BUCKET}
regions = us-east-1
image:
docker build --tag redirection:lambci12.x .
build: image
docker run --rm --volume ${PWD}/lambda/origin-request-function:/build redirection:lambci12.x /bin/bash -c "npm init -f -y; npm install [email protected] --save; npm install [email protected] --save; npm install --only=prod"
docker run --rm --volume ${PWD}/lambda/deploy-function:/build redirection:lambci12.x /bin/bash -c "npm init -f -y; npm install [email protected] --save; npm install [email protected] --save; npm install [email protected] --save; npm install --only=prod"
cd userinterface;bower install [email protected]
cd userinterface;bower install [email protected]
cd userinterface;bower install [email protected]
cd userinterface;bower install [email protected]
cd userinterface;bower install [email protected]
package:
mkdir -p dist && cd lambda/origin-request-function && zip -FS -q -r ../../dist/origin-request-function.zip *
mkdir -p dist && cd lambda/deploy-function && zip -FS -q -r ../../dist/deploy-function.zip *
mkdir -p dist && cd userinterface && zip -FS -q -r ../dist/ui.zip *
creates3:
@for region in $(regions);do echo $$region; echo $(bucket);aws s3 mb s3://$(bucket)-$$region --region $$region;done
deletes3:
@for region in $(regions);do echo $$region; echo $(bucket);aws s3 rb s3://$(bucket)-$$region --force;done
copycode:
@for region in $(regions);do echo $$region; echo $(bucket);aws s3 cp dist/deploy-function.zip s3://$(bucket)-$$region/redirection/lambda/latest/ --acl public-read;aws s3 cp dist/origin-request-function.zip s3://$(bucket)-$$region/redirection/lambda/latest/ --acl public-read;aws s3 cp dist/ui.zip s3://$(bucket)-$$region/redirection/ui/latest/ --acl public-read;done
copytemplate:
sed -e "s/CODE_BUCKET/${bucket}/g" cloudformation/template.yaml > dist/template.yaml
@for region in $(regions);do echo $$region; echo $(bucket);aws s3 cp dist/template.yaml s3://$(bucket)-$$region/redirection/template/latest/ --acl public-read;done
deploy: build package creates3 copycode copytemplate
@echo "*************************"
@echo "Deployment URL (copy and paste in browser)"
@echo " https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=RedirectionEdge&templateURL=https://s3.amazonaws.com/${bucket}-us-east-1/redirection/template/latest/template.yaml";
clean:
rm -rf ./dist/*
rm -rf userinterface/bower_components/