-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·83 lines (56 loc) · 1.44 KB
/
Makefile
File metadata and controls
executable file
·83 lines (56 loc) · 1.44 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
HANDLER=handler
PACKAGE=package
ifdef DOTENV
DOTENV_TARGET=dotenv
else
DOTENV_TARGET=.env
endif
test:
docker-compose run app godog
bash:
docker-compose run app bash
########################################
# entrypoints - run within docker only #
########################################
deps:
docker-compose run --rm sls-go make _deps
.PHONY: deps
build: $(DOTENV_TARGET) _clean deps
docker-compose run --rm sls-go make _build
.PHONY: build
tests: $(DOTENV_TARGET) deps
docker-compose run --rm sls-go make _test
.PHONY: tests
deploy: $(DOTENV_TARGET)
docker-compose run --rm sls-go make _deploy
.PHONY: deploy
remove: $(DOTENV_TARGET)
docker-compose run --rm sls-go make _remove
.PHONY: remove
shell: $(DOTENV_TARGET)
docker-compose run --rm sls-go bash
.PHONY: shell
########################################
# others - run within or out of docker #
########################################
.env:
@echo "Create .env with .env.template"
cp .env.template .env
dotenv:
@echo "Switching .env to $(DOTENV)"
cp $(DOTENV) .env
# target to run within container
_clean:
@rm -rf .serverless $(HANDLER).zip $(HANDLER).so $(PACKAGE).zip
_deps:
@dep ensure
_build:
@go build -buildmode=plugin -ldflags='-w -s' -o $(HANDLER).so
@pack $(HANDLER) $(HANDLER).so $(PACKAGE).zip
@chown $(shell stat -c '%u:%g' .) $(HANDLER).so $(PACKAGE).zip
_test:
@go test $(shell go list ./... | grep -v /vendor/)
_deploy:
@sls deploy -v
_remove:
@sls remove -v