-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (61 loc) · 1.64 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
78
79
export PROJECT_NAME = lambda-php-skeleton
DOCKER_COMPOSE = docker-compose
RUN = $(DOCKER_COMPOSE) run --rm ${PROJECT_NAME}
# DOCKER
start:
$(DOCKER_COMPOSE) up -d
.PHONY: start
ps:
$(DOCKER_COMPOSE) ps
.PHONY: ps
logs:
$(DOCKER_COMPOSE) logs -f
.PHONY: logs
# DEVELOPMENT
cli:
$(RUN) /bin/bash
.PHONY: cli
composer-update:
$(RUN) composer update
.PHONY: composer-update
composer-install:
$(RUN) composer install
.PHONY: composer-install
phpstan:
$(RUN) sh -c "./vendor/bin/phpstan analyze -c dev/phpstan.neon"
.PHONY: phpstan
php-cs-fixer:
$(RUN) sh -c "./vendor/bin/php-cs-fixer fix --config=dev/php-cs-fixer.php_cs"
.PHONY: php-cs-fixer
# DEPLOYMENT
serverless-deploy: composer-install-prod
$(RUN) serverless deploy --stage dev
.PHONY: serverless-deploy
composer-install-prod:
$(RUN) composer install --prefer-dist --optimize-autoloader --no-dev
.PHONY: composer-install-prod
# DEBUG
serverless-print: ## print generated serverless.yml with all populated values
$(RUN) serverless print --stage dev
.PHONY: serverless-print
bref-layers:
$(RUN) vendor/bin/bref layers eu-central-1
.PHONY: bref-layers
# INVOKE FUNCTIONS LOCALLY
function-invoke-local:
$(RUN) vendor/bin/bref local function '{"year": 2020}'
.PHONY: function-invoke-local
# INVOKE FUNCTIONS ON AWS
function-invoke-cloud:
$(RUN) serverless invoke --stage dev --function function --data "hello world"
.PHONY: function-invoke-cloud
# MONITORING
bref-dashboard:
vendor/bin/bref dashboard
.PHONY: bref-dashboard
function-logs:
$(RUN) serverless logs --stage dev --function function
.PHONY: http-logs
http-logs:
$(RUN) serverless logs --stage dev --function http --tail
.PHONY: http-logs