-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (40 loc) · 1.22 KB
/
Makefile
File metadata and controls
56 lines (40 loc) · 1.22 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
54
55
56
APP_NAME ?= fastapi-eks
ECR_REPO ?= 361769569278.dkr.ecr.ap-southeast-1.amazonaws.com/$(APP_NAME)
REGION ?= ap-southeast-1
CLUSTER_NAME ?= fastapi-cluster
ENV ?= dev
NAMESPACE ?= fastapi-$(ENV)
.PHONY: all test build push update-image deploy logs clean status ecr-login compose-up compose-down compose-test
all: test build push update-image deploy
build:
docker build --platform linux/amd64 -t $(APP_NAME):latest .
push:
docker tag $(APP_NAME):latest $(ECR_REPO):latest
docker push $(ECR_REPO):latest
update-image:
kustomize edit set image $(APP_NAME)=$(ECR_REPO):latest k8s/overlays/$(ENV)/
deploy:
kubectl apply -k k8s/overlays/$(ENV)/
logs:
kubectl logs -l app=fastapi -n $(NAMESPACE)
clean:
kubectl delete -k k8s/overlays/$(ENV)/
kubectl delete namespace $(NAMESPACE) --ignore-not-found
ecr-login:
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(ECR_REPO)
status:
kubectl get pods -n $(NAMESPACE)
up:
docker-compose up -d --build $(target)
down:
docker-compose down
test:
docker-compose up -d
docker-compose exec app pytest
docker-compose down
log:
docker-compose logs -f $(target)
ssh:
docker-compose exec app bash
restart:
docker-compose restart $(target)