generated from dstilesr/fastapi-lambda-poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
69 lines (62 loc) · 1.73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
version: 3
tasks:
terraform-init:
desc: Initialize Terraform.
dir: infrastructure
sources:
- "**/main.tf"
cmds:
- cd ecr && terraform init && cd ..
- cd service && terraform init && cd ..
deploy-ecr:
desc: Deploy the ECR to store docker images.
dir: infrastructure/ecr
deps:
- terraform-init
cmds:
- terraform validate
- terraform apply -auto-approve -input=false
deploy-service:
desc: Deploy the service to ECS.
dir: infrastructure/service
deps:
- terraform-init
cmds:
- terraform validate
- terraform apply -auto-approve -input=false
load-img-to-ecr:
desc: Load the image to ECR.
sources:
- src/**/*.py
dotenv:
- ".env"
cmds:
- aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin $ECR_URI
- docker build -t ecs-api-test-repository .
- docker tag ecs-api-test-repository:latest $ECR_URI/ecs-api-test-repository:latest
- docker push $ECR_URI/ecs-api-test-repository:latest
deploy:
desc: Deploy the function to AWS.
dir: infrastructure
deps:
- terraform-init
cmds:
- task: deploy-ecr
- task: load-img-to-ecr
- task: deploy-service
take-down-service:
desc: Take down the service infrastructure from AWS.
dir: infrastructure/service
cmds:
- terraform destroy -auto-approve -input=false
take-down-ecr:
desc: Take down the ECR infrastructure from AWS.
dir: infrastructure/ecr
cmds:
- terraform destroy -auto-approve -input=false
take-down:
desc: Take down the infrastructure from AWS.
dir: infrastructure
cmds:
- task: take-down-service
- task: take-down-ecr