Skip to content

Commit eea0b6c

Browse files
authored
AAP-48026: Mechanism to define and retrieve stack version. (#52)
1 parent 9169ad8 commit eea0b6c

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Containerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
# Build arguments declared in the global scope.
12
ARG ANSIBLE_CHATBOT_BASE_IMAGE=ansible-chatbot-stack-base
3+
ARG ANSIBLE_CHATBOT_VERSION=latest
24
ARG LLAMA_STACK_VERSION=0.2.9
35

46
FROM ${ANSIBLE_CHATBOT_BASE_IMAGE}:${LLAMA_STACK_VERSION}
57

8+
# Re-declaring arguments without a value, inherits the global default one.
9+
ARG ANSIBLE_CHATBOT_VERSION
610
ENV LLAMA_STACK_CONFIG_DIR=/.llama/data
711

812
# Data and configuration
913
RUN mkdir -p /.llama/distributions/ansible-chatbot
1014
RUN mkdir -p /.llama/data/distributions/ansible-chatbot
1115
ADD ansible-chatbot-run.yaml /.llama/distributions/ansible-chatbot
16+
RUN echo -e "\
17+
{\n\
18+
\"version\": \"${ANSIBLE_CHATBOT_VERSION}\" \n\
19+
}\n\
20+
" > /.llama/distributions/ansible-chatbot/ansible-chatbot-version-info.json
1221
RUN chmod -R g+rw /.llama
1322

1423
# Bootstrap

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ check-env-build-custom:
8989
exit 1; \
9090
fi
9191

92-
build-custom: check-env-build-custom build
92+
build-custom: check-env-build-custom
9393
@echo "Building customized Ansible Chatbot Stack image..."
94-
docker build -f Containerfile -t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION) --build-arg LLAMA_STACK_VERSION=$(LLAMA_STACK_VERSION) .
94+
docker build -f Containerfile -t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION) \
95+
--build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION) \
96+
--build-arg LLAMA_STACK_VERSION=$(LLAMA_STACK_VERSION) .
9597
@printf "Custom image $(RED)ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION)$(NC) built successfully.\n"
9698

9799
# Pre-check required environment variables for build-lsc
@@ -103,7 +105,9 @@ check-env-build-lsc:
103105

104106
build-lsc: check-env-build-lsc
105107
@echo "Building customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack..."
106-
docker build -f ./lightspeed-stack/Containerfile.lsc -t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION) .
108+
docker build -f ./lightspeed-stack/Containerfile.lsc \
109+
--build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION) \
110+
-t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION) .
107111
@printf "Custom image $(RED)ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION)$(NC) built successfully.\n"
108112

109113
# Pre-check for required environment variables

lightspeed-stack/Containerfile.lsc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Build arguments declared in the global scope.
2+
ARG ANSIBLE_CHATBOT_VERSION=latest
3+
14
# ======================================================
25
# Transient image to construct Python venv
36
# ------------------------------------------------------
@@ -30,6 +33,8 @@ FROM quay.io/lightspeed-core/lightspeed-stack:latest
3033

3134
USER 0
3235

36+
# Re-declaring arguments without a value, inherits the global default one.
37+
ARG ANSIBLE_CHATBOT_VERSION
3338
ARG APP_ROOT=/app-root
3439
RUN microdnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs python3.11
3540
WORKDIR /app-root
@@ -58,6 +63,11 @@ ENV LLAMA_STACK_CONFIG_DIR=/.llama/data
5863
RUN mkdir -p /.llama/distributions/ansible-chatbot
5964
RUN mkdir -p /.llama/data/distributions/ansible-chatbot
6065
ADD ansible-chatbot-run.yaml /.llama/distributions/ansible-chatbot
66+
RUN echo -e "\
67+
{\n\
68+
\"version\": \"${ANSIBLE_CHATBOT_VERSION}\" \n\
69+
}\n\
70+
" > /.llama/distributions/ansible-chatbot/ansible-chatbot-version-info.json
6171
ADD llama-stack/providers.d /.llama/providers.d
6272
RUN chmod -R g+rw /.llama
6373

0 commit comments

Comments
 (0)