2
2
3
3
# Default values for environment variables
4
4
QUAY_ORG ?=
5
- ANSIBLE_CHATBOT_VERSION ?=
5
+ ANSIBLE_CHATBOT_VERSION ?= latest
6
6
ANSIBLE_CHATBOT_VLLM_URL ?=
7
7
ANSIBLE_CHATBOT_VLLM_API_TOKEN ?=
8
8
ANSIBLE_CHATBOT_INFERENCE_MODEL ?=
@@ -17,6 +17,15 @@ LLAMA_STACK_RUN_CONFIG ?= ansible-chatbot-run.yaml
17
17
RED := \033[0;31m
18
18
NC := \033[0m # No Color
19
19
20
+ # Choose between docker and podman based on what is available
21
+ ifeq (, $(shell which podman) )
22
+ CONTAINER_RUNTIME ?= docker
23
+ else
24
+ CONTAINER_RUNTIME ?= podman
25
+ endif
26
+
27
+
28
+
20
29
.PHONY : help setup build build-custom run clean all deploy-k8s shell tag-and-push
21
30
22
31
.EXPORT_ALL_VARIABLES :
36
45
@echo " run - Run the Ansible Chatbot Stack container built with 'build-lsc'"
37
46
@echo " run-test - Run some sanity checks for the Ansible Chatbot Stack container built with 'build-lsc'"
38
47
@echo " run-local-db - Run the Ansible Chatbot Stack container with local DB mapped to conatiner DB"
39
- @echo " clean - Clean up generated files and Docker images"
48
+ @echo " clean - Clean up generated files and container images"
40
49
@echo " deploy-k8s - Deploy to Kubernetes cluster"
41
50
@echo " shell - Get a shell in the container"
42
51
@echo " tag-and-push - Tag and push the container image to quay.io"
@@ -52,21 +61,23 @@ help:
52
61
@echo " LLAMA_STACK_PORT - Port to expose (default: $( LLAMA_STACK_PORT) )"
53
62
@echo " QUAY_ORG - Quay organization name (default: $( QUAY_ORG) )"
54
63
55
- setup : setup-vector-db
64
+ setup : setup-vector-db llama-stack/providers.d/inline/agents/lightspeed_inline_agent.yaml
65
+ llama-stack/providers.d/inline/agents/lightspeed_inline_agent.yaml :
56
66
@echo " Setting up environment..."
57
67
uv sync
58
68
mkdir -p llama-stack/providers.d/inline/agents/
59
69
curl -o llama-stack/providers.d/inline/agents/lightspeed_inline_agent.yaml https://raw.githubusercontent.com/lightspeed-core/lightspeed-providers/refs/heads/main/resources/external_providers/inline/agents/lightspeed_inline_agent.yaml
60
70
@echo " Environment setup complete."
61
71
62
- setup-vector-db :
72
+ setup-vector-db : vector_db/aap_faiss_store.db
73
+ vector_db/aap_faiss_store.db :
63
74
@echo " Setting up vector db and embedding image..."
64
75
rm -rf ./vector_db ./embeddings_model
65
76
mkdir -p ./vector_db
66
- docker run --platform $(PLATFORM ) -d --rm --name rag-content $(RAG_CONTENT_IMAGE ) sleep infinity
67
- docker cp rag-content:/rag/llama_stack_vector_db/faiss_store.db.gz ./vector_db/aap_faiss_store.db.gz
68
- docker cp rag-content:/rag/embeddings_model .
69
- docker kill rag-content
77
+ $( CONTAINER_RUNTIME ) run --platform $(PLATFORM ) -d --rm --name rag-content $(RAG_CONTENT_IMAGE ) sleep infinity
78
+ $( CONTAINER_RUNTIME ) cp rag-content:/rag/llama_stack_vector_db/faiss_store.db.gz ./vector_db/aap_faiss_store.db.gz
79
+ $( CONTAINER_RUNTIME ) cp rag-content:/rag/embeddings_model .
80
+ $( CONTAINER_RUNTIME ) kill rag-content
70
81
gzip -d ./vector_db/aap_faiss_store.db.gz
71
82
# this permission changes will allow the container user 1001 to read/write the files
72
83
# in these directories
@@ -80,12 +91,12 @@ check-env-build:
80
91
exit 1; \
81
92
fi
82
93
83
- requirements :
94
+ requirements.txt :
84
95
uv export --no-hashes --no-header --no-annotate --no-dev --format requirements.txt > requirements.txt
85
96
86
- build : check-env-build requirements
97
+ build : check-env-build setup requirements.txt
87
98
@echo " Building customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack..."
88
- docker build --no-cache --platform $(PLATFORM ) -f ./Containerfile \
99
+ $( CONTAINER_RUNTIME ) build --no-cache --platform $(PLATFORM ) -f ./Containerfile \
89
100
--build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION ) \
90
101
--build-arg LLAMA_STACK_RUN_CONFIG=$(LLAMA_STACK_RUN_CONFIG ) \
91
102
-t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION ) .
@@ -114,7 +125,7 @@ run: check-env-run
114
125
@echo " Running Ansible Chatbot Stack container..."
115
126
@echo " Using vLLM URL: $( ANSIBLE_CHATBOT_VLLM_URL) "
116
127
@echo " Using inference model: $( ANSIBLE_CHATBOT_INFERENCE_MODEL) "
117
- docker run --platform $(PLATFORM ) --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
128
+ $( CONTAINER_RUNTIME ) run --platform $(PLATFORM ) --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
118
129
-v ./embeddings_model:/.llama/data/embeddings_model \
119
130
-v ./vector_db/aap_faiss_store.db:$(CONTAINER_DB_PATH ) /aap_faiss_store.db \
120
131
-v ./$(LIGHTSPEED_STACK_CONFIG ) :/.llama/distributions/ansible-chatbot/config/lightspeed-stack.yaml \
@@ -152,7 +163,7 @@ run-local-db: check-env-run-local-db
152
163
@echo " Using inference model: $( ANSIBLE_CHATBOT_INFERENCE_MODEL) "
153
164
@echo " Using inference model for tools filtering : $( ANSIBLE_CHATBOT_INFERENCE_MODEL_FILTER) "
154
165
@echo " Mapping local DB from $( LOCAL_DB_PATH) to $( CONTAINER_DB_PATH) "
155
- docker run --platform $(PLATFORM ) --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
166
+ $( CONTAINER_RUNTIME ) run --platform $(PLATFORM ) --security-opt label=disable -it -p $(LLAMA_STACK_PORT ) :8080 \
156
167
-v $(LOCAL_DB_PATH ) :$(CONTAINER_DB_PATH ) \
157
168
-v ./embeddings_model:/app/embeddings_model \
158
169
-v ./vector_db/aap_faiss_store.db:$(CONTAINER_DB_PATH ) /aap_faiss_store.db \
@@ -172,10 +183,11 @@ clean:
172
183
rm -rf llama-stack/
173
184
rm -rf providers.d/
174
185
rm -rf work/
186
+ rm -f requirements.txt
175
187
@echo " Removing ansible-chatbot-stack images..."
176
- docker rmi -f $$(docker images -a -q --filter reference=ansible-chatbot-stack ) || true
188
+ $( CONTAINER_RUNTIME ) rmi -f $$($( CONTAINER_RUNTIME ) images -a -q --filter reference=ansible-chatbot-stack) || true
177
189
@echo " Removing ansible-chatbot-stack containers..."
178
- docker rm -f $$(docker ps -a -q --filter ancestor=ansible-chatbot-stack ) || true
190
+ $( CONTAINER_RUNTIME ) rm -f $$($( CONTAINER_RUNTIME ) ps -a -q --filter ancestor=ansible-chatbot-stack) || true
179
191
@echo " Clean-up complete."
180
192
181
193
deploy-k8s :
@@ -187,7 +199,7 @@ deploy-k8s:
187
199
188
200
shell :
189
201
@echo " Getting a shell in the container..."
190
- docker run --security-opt label=disable -it --entrypoint /bin/bash ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
202
+ $( CONTAINER_RUNTIME ) run --security-opt label=disable -it --entrypoint /bin/bash ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
191
203
192
204
# Pre-check required environment variables for tag-and-push
193
205
check-env-tag-and-push :
@@ -203,11 +215,11 @@ check-env-tag-and-push:
203
215
tag-and-push : check-env-tag-and-push
204
216
@echo " Logging in to quay.io..."
205
217
@echo " Please enter your quay.io credentials when prompted"
206
- docker login quay.io
218
+ $( CONTAINER_RUNTIME ) login quay.io
207
219
@echo " Tagging image ansible-chatbot-stack:$( ANSIBLE_CHATBOT_VERSION) "
208
- docker tag ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION ) quay.io/$(QUAY_ORG ) /ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
220
+ $( CONTAINER_RUNTIME ) tag ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION ) quay.io/$(QUAY_ORG ) /ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
209
221
@echo " Pushing image to quay.io..."
210
- docker push quay.io/$(QUAY_ORG ) /ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
222
+ $( CONTAINER_RUNTIME ) push quay.io/$(QUAY_ORG ) /ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION )
211
223
@echo " Image successfully pushed to quay.io/$( QUAY_ORG) /ansible-chatbot-stack:$( ANSIBLE_CHATBOT_VERSION) "
212
224
213
225
all : setup build build-custom
0 commit comments