diff --git a/recipes/natural_language_processing/rag/Makefile b/recipes/natural_language_processing/rag/Makefile index ef827e3d5..86d4f386b 100644 --- a/recipes/natural_language_processing/rag/Makefile +++ b/recipes/natural_language_processing/rag/Makefile @@ -1,30 +1,35 @@ APP=rag +CHROMADBIMAGE ?= quay.io/ai-lab/chromadb:latest MODELIMAGE ?= quay.io/ai-lab/mistral-7b-instruct:latest APPIMAGE ?= quay.io/ai-lab/${APP}:latest SERVERIMAGE ?= quay.io/ai-lab/llamacpp-python:latest SSHPUBKEY ?= $(shell cat ${HOME}/.ssh/id_rsa.pub;) +BOOTCIMAGE ?= quay.io/ai-lab/${APP}-bootc:latest + .PHONY: build build: - podman build -f builds/Containerfile -t ghcr.io/ai-lab-recipes/${APP} . + podman build -f builds/Containerfile -t ${APPIMAGE} . .PHONY: bootc bootc: - sudo podman build --cap-add SYS_ADMIN --build-arg "SSHPUBKEY=$(SSHPUBKEY)" -f bootc/Containerfile -t ghcr.io/ai-lab-recipes/${APP}-bootc . + podman build --cap-add SYS_ADMIN --build-arg "SSHPUBKEY=$(SSHPUBKEY)" -f bootc/Containerfile -t ${BOOTCIMAGE} . .PHONY: quadlet quadlet: -# Modify quadlet files to match the server, model and app image + # Modify quadlet files to match the server, model and app image mkdir -p build sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \ -e "s|APPIMAGE|${APPIMAGE}|g" \ -e "s|MODELIMAGE|${MODELIMAGE}|g" \ + -e "s|CHROMADBIMAGE|${CHROMADBIMAGE}|g" \ quadlet/${APP}.image \ > build/${APP}.image sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \ -e "s|APPIMAGE|${APPIMAGE}|g" \ -e "s|MODELIMAGE|${MODELIMAGE}|g" \ + -e "s|CHROMADBIMAGE|${CHROMADBIMAGE}|g" \ quadlet/${APP}.yaml \ - > /tmp/${APP}.yaml + > build/${APP}.yaml cp quadlet/${APP}.kube build/${APP}.kube .PHONY: install diff --git a/recipes/natural_language_processing/rag/bootc/Containerfile b/recipes/natural_language_processing/rag/bootc/Containerfile index 2e2be1466..259a416ca 100644 --- a/recipes/natural_language_processing/rag/bootc/Containerfile +++ b/recipes/natural_language_processing/rag/bootc/Containerfile @@ -22,21 +22,38 @@ ARG RECIPE=rag ARG MODELIMAGE=quay.io/ai-lab/mistral-7b-instruct:latest ARG APPIMAGE=quay.io/ai-lab/${RECIPE}:latest ARG SERVERIMAGE=quay.io/ai-lab/llamacpp-python:latest +ARG CHROMADBImage=quay.io/ai-lab/chromadb # Add quadlet files to setup system to automatically run AI application on boot -COPY quadlet/${RECIPE}.kube quadlet/${RECIPE}.yaml quadlet/${RECIPE}.image /usr/share/containers/systemd +COPY quadlet/${RECIPE}.kube quadlet/${RECIPE}.yaml /usr/share/containers/systemd # Modify quadlet files to match the server, model and app image RUN sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \ -e "s|APPIMAGE|${APPIMAGE}|g" \ -e "s|MODELIMAGE|${MODELIMAGE}|g" \ -i \ - /usr/share/containers/systemd/${RECIPE}.image \ /usr/share/containers/systemd/${RECIPE}.yaml +# Because images are prepulled, no need for .image quadlet +# COPY quadlet/${RECIPE}.image /usr/share/containers/systemd +# RUN sed -e "s|SERVERIMAGE|${SERVERIMAGE}|" \ +# -e "s|APPIMAGE|${APPIMAGE}|g" \ +# -e "s|MODELIMAGE|${MODELIMAGE}|g" \ +# -i \ +# /usr/share/containers/systemd/${RECIPE}.image + +# Setup /usr/lib/containers/storage as an additional store for images. +# Remove once the base images have this set by default. RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \ /etc/containers/storage.conf +# Added for running as an OCI Container to prevent Overlay on Overlay issues. +VOLUME /var/lib/containers + +# Prepull the model, model_server & application images to populate the system. RUN podman pull --root /usr/lib/containers/storage ${SERVERIMAGE} RUN podman pull --root /usr/lib/containers/storage ${APPIMAGE} RUN podman pull --root /usr/lib/containers/storage ${MODELIMAGE} +RUN podman pull --root /usr/lib/containers/storage ${CHROMADBImage} + +RUN podman system reset --force 2>/dev/null diff --git a/recipes/natural_language_processing/rag/quadlet/rag.yaml b/recipes/natural_language_processing/rag/quadlet/rag.yaml index 329e57be9..bec10a8fc 100644 --- a/recipes/natural_language_processing/rag/quadlet/rag.yaml +++ b/recipes/natural_language_processing/rag/quadlet/rag.yaml @@ -23,6 +23,16 @@ spec: hostPort: 8501 securityContext: runAsNonRoot: true + - env: + - name: CHROMADB_ENDPOINT + value: http://0.0.0.0:800O/v1 + image: CHROMADBIMAGE + name: rag-chromadb + ports: + - containerPort: 8000 + hostPort: 8000 + securityContext: + runAsNonRoot: true - env: - name: HOST value: 0.0.0.0 diff --git a/vector_dbs/Makefile b/vector_dbs/Makefile new file mode 100644 index 000000000..e37259281 --- /dev/null +++ b/vector_dbs/Makefile @@ -0,0 +1,6 @@ +APP ?= chromadb +APPIMAGE ?= quay.io/ai-lab/${APP}:latest + +.PHONY: build +build: + podman build -f chromadb/Containerfile -t ${APPIMAGE} .