-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
56 lines (52 loc) · 1.34 KB
/
Taskfile.yml
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
version: 3
tasks:
terraform-init:
desc: Initialize Terraform.
dir: infrastructure
sources:
- main.tf
cmds:
- terraform init
package-layer:
desc: Make Zip file containing the libraries the function will use.
sources:
- requirements.txt
generates:
- layer-src.zip
cmds:
- rm -f layer-src.zip
- mkdir -p layer-src/python/lib/python3.9/site-packages/
- pip install -r requirements.txt --target layer-src/python/lib/python3.9/site-packages/ --no-cache-dir
- |
cd layer-src \
&& zip ../layer-src.zip -r . \
&& cd .. \
&& rm -r layer-src
package-lambda:
desc: Package lambda zip file for deployment.
deps:
- package-layer
sources:
- src/**/*.py
cmds:
- rm -f lambda-src.zip
- cp -R src lambda-src
- |
cd lambda-src \
&& zip ../lambda-src.zip -r . \
&& cd .. \
&& rm -r lambda-src
deploy:
desc: Deploy the function to AWS Lambda + API Gateway.
dir: infrastructure
deps:
- terraform-init
- package-lambda
cmds:
- terraform validate
- terraform apply -auto-approve -input=false
take-down:
desc: Take down the infrastructure from AWS.
dir: infrastructure
cmds:
- terraform destroy -auto-approve -input=false