-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (61 loc) · 1.65 KB
/
Makefile
File metadata and controls
72 lines (61 loc) · 1.65 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
app := ai-chatbot
platform := linux/amd64
all: help
.PHONY: help
help: Makefile
@echo
@echo " Choose a make command to run"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
## init: initialize a new python project
.PHONY: init
init:
python -m venv .venv
direnv allow .
## install: add a new package (make install <package>), or install all project dependencies from piplock.txt (make install)
.PHONY: install
install:
python -m pip install --upgrade pip
@if [ -z "$(filter-out install,$(MAKECMDGOALS))" ]; then \
echo "Installing dependencies from piplock.txt"; \
pip install -r piplock.txt; \
else \
pkg="$(filter-out install,$(MAKECMDGOALS))"; \
echo "Adding package $$pkg to requirements.txt"; \
grep -q "^$$pkg$$" requirements.txt || echo "$$pkg" >> requirements.txt; \
pip install $$pkg; \
pip install -r requirements.txt; \
pip freeze > piplock.txt; \
fi
# Empty rule to handle package name argument
%:
@:
## start: run local project
.PHONY: start
start:
clear
@echo ""
git ls-files | grep -v iac | entr -r python main.py
## baseimage: build base image
.PHONY: baseimage
baseimage:
docker build -t ai-chat-accelerator-base -f Dockerfile.base --platform ${platform} .
## deploy: build and deploy container
.PHONY: deploy
deploy:
./deploy.sh ${app} ${platform}
## up: run the app locally using docker compose
.PHONY: up
up: baseimage
docker compose build && docker compose up -d && docker compose logs -f
## down: stop the app
.PHONY: down
down:
docker compose down
## start-docker: run local project using docker compose
.PHONY: start-docker
start-docker:
clear
@echo ""
git ls-files | grep -v iac | entr -r make up