Skip to content

Commit 0504dc1

Browse files
authored
fixes the Containerfile (#74)
Fixes the Containerfile to use the latest image from lightspeed-stack issue: https://issues.redhat.com/browse/AAP-50401 Signed-off-by: Djebran Lezzoum <[email protected]>
1 parent 574d37a commit 0504dc1

File tree

6 files changed

+150
-23
lines changed

6 files changed

+150
-23
lines changed

Containerfile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ ARG ANSIBLE_CHATBOT_VERSION=latest
44
# ======================================================
55
# Transient image to construct Python venv
66
# ------------------------------------------------------
7-
FROM registry.access.redhat.com/ubi9/ubi-minimal AS builder
7+
FROM quay.io/lightspeed-core/lightspeed-stack:dev-latest AS builder
88

99
ARG APP_ROOT=/app-root
10-
RUN microdnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs \
11-
python3.12 python3.12-devel python3.12-pip
1210
WORKDIR /app-root
1311

1412
# UV_PYTHON_DOWNLOADS=0 : Disable Python interpreter downloads and use the system interpreter.
@@ -21,17 +19,15 @@ RUN pip3.12 install uv
2119

2220
# Add explicit files and directories
2321
# (avoid accidental inclusion of local directories or env files or credentials)
24-
COPY pyproject.toml uv.lock LICENSE.md README.md ./
22+
COPY requirements.txt LICENSE.md README.md ./
2523

26-
RUN uv sync --locked --no-install-project --no-dev
24+
RUN uv pip install -r requirements.txt
2725
# ======================================================
2826

2927
# ======================================================
30-
# Final image without uv package manager
28+
# Final image without uv package manager and based on lightspeed-stack base image
3129
# ------------------------------------------------------
32-
#FROM quay.io/lightspeed-core/lightspeed-stack:dev-latest
33-
# the lastest was broken, replace by the latest working image for now
34-
FROM quay.io/lightspeed-core/lightspeed-stack:dev-20250722-28abfaf
30+
FROM registry.access.redhat.com/ubi9/python-312-minimal
3531

3632
USER 0
3733

@@ -50,14 +46,11 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
5046
PYTHONIOENCODING=UTF-8 \
5147
LANG=en_US.UTF-8
5248

53-
COPY --from=builder /app-root /app-root
49+
COPY --from=builder --chown=1001:1001 /app-root /app-root
5450

5551
# this directory is checked by ecosystem-cert-preflight-checks task in Konflux
5652
COPY --from=builder /app-root/LICENSE.md /licenses/
5753

58-
# Add executables from .venv to system PATH
59-
ENV PATH="/app-root/.venv/bin:$PATH"
60-
6154
ENV LLAMA_STACK_CONFIG_DIR=/.llama/data
6255

6356
# Data and configuration
@@ -69,14 +62,21 @@ RUN echo -e "\
6962
}\n\
7063
" > /.llama/distributions/ansible-chatbot/ansible-chatbot-version-info.json
7164
ADD llama-stack/providers.d /.llama/providers.d
72-
RUN chmod -R g+rw /.llama
7365

7466
# Bootstrap
7567
ADD entrypoint.sh /.llama
68+
69+
RUN chmod -R g+rw /.llama
7670
RUN chmod +x /.llama/entrypoint.sh
7771

78-
# See https://github.com/meta-llama/llama-stack/issues/1633
79-
# USER 1001
72+
RUN chown -R 1001:1001 /.llama
73+
74+
USER 1001
75+
76+
# Add executables from .venv to system PATH
77+
78+
ENV PATH="/app-root/.venv/bin:$PATH"
79+
LABEL vendor="Red Hat, Inc."
8080

81-
ENTRYPOINT ["/.llama/entrypoint.sh"]
81+
ENTRYPOINT ["/.llama/entrypoint.sh", "/app-root/.venv/bin/python3.12"]
8282
# ======================================================

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ setup-vector-db:
6868
docker cp rag-content:/rag/embeddings_model .
6969
docker kill rag-content
7070
gzip -d ./vector_db/aap_faiss_store.db.gz
71+
# this permission changes will allow the container user 1001 to read/write the files
72+
# in these directories
73+
chmod -R o+rw ./vector_db/
74+
chmod -R o+rw ./embeddings_model/
7175

7276
# Pre-check required environment variables for build
7377
check-env-build:
@@ -76,9 +80,12 @@ check-env-build:
7680
exit 1; \
7781
fi
7882

79-
build: check-env-build
83+
requirements:
84+
uv export --no-hashes --no-header --no-annotate --no-dev --format requirements.txt > requirements.txt
85+
86+
build: check-env-build requirements
8087
@echo "Building customized Ansible Chatbot Stack image from lightspeed-core/lightspeed-stack..."
81-
docker build --platform $(PLATFORM) -f ./Containerfile \
88+
docker build --no-cache --platform $(PLATFORM) -f ./Containerfile \
8289
--build-arg ANSIBLE_CHATBOT_VERSION=$(ANSIBLE_CHATBOT_VERSION) \
8390
--build-arg LLAMA_STACK_RUN_CONFIG=$(LLAMA_STACK_RUN_CONFIG) \
8491
-t ansible-chatbot-stack:$(ANSIBLE_CHATBOT_VERSION) .

entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
MOUNTPATH=/.llama/data
33

4+
PYTHON_CMD="$@"
5+
46
echo "Checking preloaded embedding model..."
57
if [[ -e /.llama/data/distributions/ansible-chatbot/embeddings_model ]]; then
68
echo "/.llama/data/distributions/ansible-chatbot/embeddings_model already exists."
@@ -23,4 +25,4 @@ else
2325
fi
2426
fi
2527

26-
python3.12 /app-root/src/lightspeed_stack.py --config /.llama/distributions/ansible-chatbot/config/lightspeed-stack.yaml
28+
${PYTHON_CMD} /app-root/src/lightspeed_stack.py --config /.llama/distributions/ansible-chatbot/config/lightspeed-stack.yaml

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies = [
99
"faiss-cpu~=1.11.0",
1010
"fire~=0.7.0",
1111
"lightspeed-stack-providers~=0.1.10",
12-
"llama-stack==0.2.14",
1312
"mcp~=1.9.4",
1413
"numpy==2.2.6",
1514
"opentelemetry-api~=1.34.1",

requirements.txt

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
aiohappyeyeballs==2.6.1
2+
aiohttp==3.12.13
3+
aiosignal==1.3.2
4+
aiosqlite==0.21.0
5+
annotated-types==0.7.0
6+
anyio==4.9.0
7+
asyncpg==0.30.0
8+
attrs==25.3.0
9+
certifi==2025.6.15
10+
charset-normalizer==3.4.2
11+
click==8.2.1
12+
colorama==0.4.6 ; sys_platform == 'win32'
13+
distro==1.9.0
14+
ecdsa==0.19.1
15+
faiss-cpu==1.11.0
16+
fastapi==0.115.13
17+
filelock==3.18.0
18+
fire==0.7.0
19+
frozenlist==1.7.0
20+
fsspec==2025.5.1
21+
googleapis-common-protos==1.70.0
22+
greenlet==3.2.3 ; (python_full_version < '3.14' and platform_machine == 'AMD64') or (python_full_version < '3.14' and platform_machine == 'WIN32') or (python_full_version < '3.14' and platform_machine == 'aarch64') or (python_full_version < '3.14' and platform_machine == 'amd64') or (python_full_version < '3.14' and platform_machine == 'ppc64le') or (python_full_version < '3.14' and platform_machine == 'win32') or (python_full_version < '3.14' and platform_machine == 'x86_64')
23+
grpcio==1.73.0
24+
h11==0.16.0
25+
hf-xet==1.1.5 ; platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'
26+
httpcore==1.0.9
27+
httpx==0.28.1
28+
httpx-sse==0.4.1
29+
huggingface-hub==0.33.0
30+
idna==3.10
31+
importlib-metadata==8.7.0
32+
jinja2==3.1.6
33+
jiter==0.10.0
34+
joblib==1.5.1
35+
jsonschema==4.24.0
36+
jsonschema-specifications==2025.4.1
37+
lightspeed-stack-providers==0.1.10
38+
llama-stack==0.2.14
39+
llama-stack-client==0.2.15
40+
markdown-it-py==3.0.0
41+
markupsafe==3.0.2
42+
mcp==1.9.4
43+
mdurl==0.1.2
44+
mpmath==1.3.0
45+
multidict==6.5.0
46+
networkx==3.5
47+
numpy==2.2.6
48+
nvidia-cublas-cu12==12.6.4.1 ; platform_machine == 'x86_64' and sys_platform == 'linux'
49+
nvidia-cuda-cupti-cu12==12.6.80 ; platform_machine == 'x86_64' and sys_platform == 'linux'
50+
nvidia-cuda-nvrtc-cu12==12.6.77 ; platform_machine == 'x86_64' and sys_platform == 'linux'
51+
nvidia-cuda-runtime-cu12==12.6.77 ; platform_machine == 'x86_64' and sys_platform == 'linux'
52+
nvidia-cudnn-cu12==9.5.1.17 ; platform_machine == 'x86_64' and sys_platform == 'linux'
53+
nvidia-cufft-cu12==11.3.0.4 ; platform_machine == 'x86_64' and sys_platform == 'linux'
54+
nvidia-cufile-cu12==1.11.1.6 ; platform_machine == 'x86_64' and sys_platform == 'linux'
55+
nvidia-curand-cu12==10.3.7.77 ; platform_machine == 'x86_64' and sys_platform == 'linux'
56+
nvidia-cusolver-cu12==11.7.1.2 ; platform_machine == 'x86_64' and sys_platform == 'linux'
57+
nvidia-cusparse-cu12==12.5.4.2 ; platform_machine == 'x86_64' and sys_platform == 'linux'
58+
nvidia-cusparselt-cu12==0.6.3 ; platform_machine == 'x86_64' and sys_platform == 'linux'
59+
nvidia-nccl-cu12==2.26.2 ; platform_machine == 'x86_64' and sys_platform == 'linux'
60+
nvidia-nvjitlink-cu12==12.6.85 ; platform_machine == 'x86_64' and sys_platform == 'linux'
61+
nvidia-nvtx-cu12==12.6.77 ; platform_machine == 'x86_64' and sys_platform == 'linux'
62+
openai==1.91.0
63+
opentelemetry-api==1.34.1
64+
opentelemetry-exporter-otlp==1.34.1
65+
opentelemetry-exporter-otlp-proto-common==1.34.1
66+
opentelemetry-exporter-otlp-proto-grpc==1.34.1
67+
opentelemetry-exporter-otlp-proto-http==1.34.1
68+
opentelemetry-proto==1.34.1
69+
opentelemetry-sdk==1.34.1
70+
opentelemetry-semantic-conventions==0.55b1
71+
packaging==25.0
72+
pandas==2.3.0
73+
pillow==11.2.1
74+
prompt-toolkit==3.0.51
75+
propcache==0.3.2
76+
protobuf==5.29.5
77+
pyaml==25.5.0
78+
pyasn1==0.6.1
79+
pydantic==2.11.7
80+
pydantic-core==2.33.2
81+
pydantic-settings==2.10.1
82+
pygments==2.19.2
83+
python-dateutil==2.9.0.post0
84+
python-dotenv==1.1.1
85+
python-jose==3.5.0
86+
python-multipart==0.0.20
87+
pytz==2025.2
88+
pyyaml==6.0.2
89+
referencing==0.36.2
90+
regex==2024.11.6
91+
requests==2.32.4
92+
rich==14.0.0
93+
rpds-py==0.25.1
94+
rsa==4.9.1
95+
safetensors==0.5.3
96+
scikit-learn==1.7.0
97+
scipy==1.16.0
98+
sentence-transformers==5.0.0
99+
setuptools==80.9.0
100+
six==1.17.0
101+
sniffio==1.3.1
102+
sqlalchemy==2.0.41
103+
sse-starlette==2.3.6
104+
starlette==0.46.2
105+
sympy==1.14.0
106+
termcolor==3.1.0
107+
threadpoolctl==3.6.0
108+
tiktoken==0.9.0
109+
tokenizers==0.21.2
110+
torch==2.7.1
111+
tqdm==4.67.1
112+
transformers==4.53.1
113+
triton==3.3.1 ; platform_machine == 'x86_64' and sys_platform == 'linux'
114+
typing-extensions==4.14.0
115+
typing-inspection==0.4.1
116+
tzdata==2025.2
117+
urllib3==2.5.0
118+
uvicorn==0.34.3
119+
wcwidth==0.2.13
120+
yarl==1.20.1
121+
zipp==3.23.0

uv.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)