-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (45 loc) · 1.63 KB
/
Makefile
File metadata and controls
53 lines (45 loc) · 1.63 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
.PHONY: build deploy clean terraform-init terraform-apply terraform-destroy test permissions
# Install dependencies and build packages
build:
@echo "Building extension layer..."
rm -rf layer-build
mkdir -p layer-build/runtime-api-proxy-extension
mkdir -p layer-build/extensions
# Copy extension code
cp -r extension/* layer-build/runtime-api-proxy-extension/
# Install dependencies
cd layer-build/runtime-api-proxy-extension && npm install --production
# Make index.mjs executable
chmod +x layer-build/runtime-api-proxy-extension/index.mjs
# Copy wrapper script to layer root
cp wrapper-script.sh layer-build/wrapper-script.sh
chmod +x layer-build/wrapper-script.sh
# Copy extension launcher
cp extension-launcher.sh layer-build/extensions/runtime-api-proxy-extension
chmod +x layer-build/extensions/runtime-api-proxy-extension
@echo "Build complete"
# Deploy infrastructure
deploy: terraform-init terraform-apply
# Initialize Terraform
terraform-init:
cd terraform && terraform init
# Apply Terraform configuration (builds first)
terraform-apply: build
cd terraform && terraform apply -auto-approve
# Destroy all AWS resources
terraform-destroy:
cd terraform && terraform destroy -auto-approve
# Test deployed Lambda functions
test:
@echo "Testing Lambda without extension:"
@curl -s $$(cd terraform && terraform output -raw without_extension_url) | jq .
@echo ""
@echo "Testing Lambda with extension:"
@curl -s $$(cd terraform && terraform output -raw with_extension_url) | jq .
# Set executable permissions
permissions:
chmod +x wrapper-script.sh
# Clean build artifacts
clean:
rm -f terraform/*.zip
rm -rf extension/node_modules