-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (27 loc) · 981 Bytes
/
Makefile
File metadata and controls
33 lines (27 loc) · 981 Bytes
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
SHELL := /bin/bash
.PHONY: clean build invoke run
# Clean build artifacts
clean:
@rm -rf .aws-sam .sam-tmp vendor composer.lock
# Build with SAM. Uses local Composer if available or Docker.
build:
@if command -v composer >/dev/null 2>&1; then \
composer install --no-dev --optimize-autoloader --classmap-authoritative; \
else \
docker run --rm -u $$(id -u):$$(id -g) -v "$$PWD":/app -w /app composer:2 install --no-dev --optimize-autoloader --classmap-authoritative; \
fi
sam build --template aws/template.local.yaml --cached --use-container
# Invoke locally (sample payload)
invoke: build
sam local invoke PhpLambdaFunction \
--template .aws-sam/build/template.yaml \
--env-vars aws/env.json \
--event tests/events/sample.json \
--shutdown
# Alias for invoke
run: invoke
# SAM build target (called by sam build)
build-PhpLambdaFunction:
cp -r vendor $(ARTIFACTS_DIR)/
cp index.php $(ARTIFACTS_DIR)/
@if [ -d "src" ]; then cp -r src $(ARTIFACTS_DIR)/; fi