-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (63 loc) · 2.12 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
# This file is part of refl.club - a personal website and blog
# Copyright (C) 2020 John Soo <jsoo1@asu.edu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
aws = docker run --rm -it --workdir / --volume $(PWD)/out:/out --volume ~/.aws:/root/.aws mikesir87/aws-cli aws
default: out/bootstrap clean-zip out/refl.club.zip
all: default modify
out/refl.club.zip: #out/bootstrap required but omitted for speed
zip -j out/refl.club.zip out/bootstrap
.PHONY: clean-zip
clean-zip:
rm out/refl.club.zip
out/bootstrap: clean-container out
docker run \
--name refl.club \
-it \
--volume $(PWD)/out:/root/.cabal/bin \
--volume $(PWD):$(PWD) \
--workdir $(PWD) \
refl-club-build \
cabal v1-install
sudo chmod 755 out/bootstrap
out:
mkdir -p out
.PHONY: clean-container
clean-container:
docker rm refl.club || true
.PHONY: clean-docker-artifacts
clean-docker-artifacts:
rm -rf dist-newstyle/build
.PHONY: build-image
build-image:
docker build -t refl-club-build:latest .
.PHONY: create
create: #out/refl.club.zip required but omitted for speed
$(aws) lambda create-function \
--function-name refl-club \
--zip-file fileb://out/refl.club.zip \
--handler Index.handler \
--runtime provided \
--role $(shell cat ~/.aws/arn)
.PHONY: modify
modify:
$(aws) lambda update-function-code \
--function-name refl-club \
--zip-file fileb://out/refl.club.zip
.PHONY: delete
delete:
$(aws) lambda delete-function --function-name refl-club
.PHONY: test
test:
$(aws) lambda invoke --function-name refl-club out/response.txt