-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.53 KB
/
Makefile
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: install-requirements database-exec rebuild-streamlit rebuild-api predict train dive
install-requirements:
pip install poetry
poetry install
poetry shell
# Define variables for the Docker image and container names
STREAMLIT_IMAGE = streamlit-app
STREAMLIT_CONTAINER = streamlit-container
API_IMAGE = app
API_CONTAINER = fastapi-container
# Set the Docker environment to use minikube
docker-env:
eval $$(minikube docker-env)
# Rebuild the specified Docker image and update the corresponding container in Kubernetes
rebuild-image:
docker build -t $(IMAGE):$(TAG) $(DOCKERFILE_DIR)/
kubectl set image deployment/$(DEPLOYMENT) $(CONTAINER)=$(IMAGE):$(TAG)
# Rebuild the Streamlit Docker image and update the corresponding container in Kubernetes
rebuild-streamlit: docker-env
$(eval DOCKERFILE_DIR := dashboard)
make rebuild-image IMAGE=$(STREAMLIT_IMAGE) CONTAINER=$(STREAMLIT_CONTAINER) DEPLOYMENT=streamlit-deployment
# Rebuild the API Docker image and update the corresponding container in Kubernetes
rebuild-api: docker-env
$(eval DOCKERFILE_DIR := .)
make rebuild-image IMAGE=$(API_IMAGE) CONTAINER=$(API_CONTAINER) DEPLOYMENT=fastapi-deployment
# Make a prediction using the API
run-api-command = poetry run python -m api.api_requests -e $(1)
predict:
$(call run-api-command,predict)
# Train the model using the API
train:
$(call run-api-command,train)
train-and-predict: rebuild-api
$(call run-api-command,train)
$(call run-api-command,predict)
dive:
docker build -t app:latest .
dive app:latest
clean:
rm -rf api/__pycache__/