-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (44 loc) · 1.32 KB
/
Makefile
File metadata and controls
55 lines (44 loc) · 1.32 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
STACK_NAME ?= todo-app
FUNCTIONS := get-todos
BUCKET_NAME := todo-app-xxx
ARCH := aarch64-unknown-linux-gnu
.PHONY: setup-api build-api deploy-api setup-ui build-ui upload-s3
api: setup-api build-api deploy-api
ui: setup-ui build-ui upload-s3
setup-api:
ifeq (,$(shell which rustc))
$(error "Could not found Rust compiler, please install it")
endif
ifeq (,$(shell which cargo))
$(error "Could not found Cargo, please install it")
endif
cargo install cargo-lambda
ifeq (,$(shell which sam))
$(error "Could not found SAM CLI, please install it")
endif
setup-ui:
ifeq (,$(shell which rustc))
$(error "Could not found Rust compiler, please install it")
endif
ifeq (,$(shell which cargo))
$(error "Could not found Cargo, please install it")
endif
ifeq (,$(shell which trunk))
$(error "Could not found Trunk, please install it")
endif
cargo install --locked wasm-bindgen-cli
build-api:
cargo lambda build --manifest-path=todo_api/Cargo.toml --release --target $(ARCH)
build-ui:
cd todo_ui;trunk build --release
deploy-api:
if [ -f samconfig.toml ]; \
then sam deploy --stack-name $(STACK_NAME); \
else sam deploy -g --stack-name $(STACK_NAME); \
fi
upload-s3:
aws s3 cp ./todo_ui/dist s3://$(BUCKET_NAME)/ --recursive
clean:
aws s3 rm s3://$(BUCKET_NAME)/ --recursive; true
aws s3 rb s3://$(BUCKET_NAME)/ --force; true
sam delete