-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (48 loc) · 1.08 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
SERVERLESS_IMG=amaysim/aws-serverless:1.4.0
DOTNET_IMG=microsoft/dotnet:sdk
ENV ?= dev
OUTPUT_DIR=bin/Release/netcoreapp1.0/publish
docker-pull:
docker pull $(DOTNET_IMG)
docker pull $(SERVERLESS_IMG)
.PHONY: docker-pull
serverless-shell:
$(call dockerServerless) bash
.PHONY: serverless-shell
deploy: dist
$(call dockerServerless) sls deploy -v
.PHONY: deploy
delete:
$(call dockerServerless) sls remove -v
.PHONY: delete
log:
$(call dockerServerless) sls logs --function hello
.PHONY: log
invoke:
$(call dockerServerless) sls invoke --function hello
.PHONY: log
deps:
$(call dockerDotNet) dotnet restore
.PHONY: deps
build: deps
$(call dockerDotNet) dotnet publish -c release
.PHONY: build
dist: build
cd $(OUTPUT_DIR) && zip -r ./deploy-package.zip ./*
.PHONY: dist
clean:
rm -rf bin obj .serverless
.PHONY: clean
define dockerDotNet
docker run -ti \
-v $(shell PWD):/opt/app \
-w /opt/app \
$(DOTNET_IMG)
endef
define dockerServerless
docker run --rm -ti --env-file env.list \
-e ENV=$(ENV) \
-v $(shell PWD):/opt/app \
-w /opt/app \
$(SERVERLESS_IMG)
endef