diff --git a/recipes/natural_language_processing/chatbot/Makefile b/recipes/natural_language_processing/chatbot/Makefile index f6123eb34..5670a7da8 100644 --- a/recipes/natural_language_processing/chatbot/Makefile +++ b/recipes/natural_language_processing/chatbot/Makefile @@ -1,6 +1,6 @@ .PHONY: build build: - podman build -t ghcr.io/ai-lab-recipes/chatbot . + podman build -f builds/Containerfile -t ghcr.io/ai-lab-recipes/chatbot . .PHONY: install install: diff --git a/recipes/natural_language_processing/chatbot/README.md b/recipes/natural_language_processing/chatbot/README.md index 438df51a1..60d74ae29 100644 --- a/recipes/natural_language_processing/chatbot/README.md +++ b/recipes/natural_language_processing/chatbot/README.md @@ -82,9 +82,3 @@ podman run --rm -it -p 8501:8501 -e MODEL_SERVICE_ENDPOINT=http://10.88.0.1:8001 ### Interact with the AI Application Everything should now be up an running with the chat application available at [`http://localhost:8501`](http://localhost:8501). By using this recipe and getting this starting point established, users should now have an easier time customizing and building their own LLM enabled chatbot applications. - - - - - - diff --git a/recipes/natural_language_processing/chatbot/bootc/Containerfile b/recipes/natural_language_processing/chatbot/bootc/Containerfile new file mode 100644 index 000000000..9098f5a3d --- /dev/null +++ b/recipes/natural_language_processing/chatbot/bootc/Containerfile @@ -0,0 +1,30 @@ +# Example: an AI powered sample application is embedded as a systemd service +# via Podman quadlet files in /usr/share/containers/systemd +# +# Use build command: +# podman build --build-arg "sshpubkey=$(cat $HOME/.ssh/mykey.pub)" -t quay.io/exampleos/chatbot . +# The --build-arg "SSHPUBKEY=$(cat ~/.ssh/mykey.pub)" option inserts your +# public key into the image, allowing root access via ssh. + +FROM quay.io/centos-bootc/centos-bootc:stream9 +ARG SSHPUBKEY +ARG MODEL-SERVER-IMAGE=quay.io/redhat-et/locallm-model-service:latest + +RUN mkdir /usr/etc-system && \ + echo 'AuthorizedKeysFile /usr/etc-system/%u.keys' >> /etc/ssh/sshd_config.d/30-auth-system.conf && \ + echo ${SSHPUBKEY} > /usr/etc-system/root.keys && chmod 0600 /usr/etc-system/root.keys + +RUN dnf -y update && (dnf install -y vim || true) && dnf clean all + +# Add quadlet files to setup system to automatically run AI application on boot +COPY ../quadlet/chatbot.kube /usr/share/containers/systemd/chatbot.kube +COPY ../quadlet/chatbot.yaml /usr/share/containers/systemd/chatbot.yaml +COPY ../quadlet/chatbot.image /usr/share/containers/systemd/chatbot.image + +# pre-pull workload images: +# Comment the pull commands to keep bootc image smaller. +# The quadlet .image file added above pulls following images on boot if not +# pre-pulled here +RUN podman pull quay.io/redhat-et/ai-model:latest +RUN podman pull ${MODEL-SERVER-IMAGE} +RUN podman pull quay.io/redhat-et/chatbot:latest diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/Containerfile b/recipes/natural_language_processing/chatbot/bootc/Containerfile~ similarity index 100% rename from recipes/natural_language_processing/chatbot/embed-in-bootable-image/Containerfile rename to recipes/natural_language_processing/chatbot/bootc/Containerfile~ diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/README.md b/recipes/natural_language_processing/chatbot/bootc/README.md similarity index 100% rename from recipes/natural_language_processing/chatbot/embed-in-bootable-image/README.md rename to recipes/natural_language_processing/chatbot/bootc/README.md diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/README.md b/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/README.md deleted file mode 100644 index 8578ec6ea..000000000 --- a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/README.md +++ /dev/null @@ -1,10 +0,0 @@ -### Run chatbot as a systemd service - -```bash -cp chatbot.yaml /usr/share/containers/systemd/chatbot.yaml -cp chatbot.kube.example /usr/share/containers/chatbot.kube -cp chatbot.image /usr/share/containers/chatbot.image -/usr/libexec/podman/quadlet --dryrun (optional) -systemctl daemon-reload -systemctl start chatbot -``` diff --git a/recipes/natural_language_processing/chatbot/quadlet/README.md b/recipes/natural_language_processing/chatbot/quadlet/README.md new file mode 100644 index 000000000..86e63337d --- /dev/null +++ b/recipes/natural_language_processing/chatbot/quadlet/README.md @@ -0,0 +1,10 @@ +### Run chatbot as a systemd service + +```bash +sudo cp chatbot.yaml /usr/share/containers/systemd/chatbot.yaml +sudo cp chatbot.kube /usr/share/containers/chatbot.kube +sudo cp chatbot.image /usr/share/containers/chatbot.image +sudo /usr/libexec/podman/quadlet --dryrun (optional) +sudo systemctl daemon-reload +sudo systemctl start chatbot +``` diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.image b/recipes/natural_language_processing/chatbot/quadlet/chatbot.image similarity index 100% rename from recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.image rename to recipes/natural_language_processing/chatbot/quadlet/chatbot.image diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.kube.example b/recipes/natural_language_processing/chatbot/quadlet/chatbot.kube similarity index 100% rename from recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.kube.example rename to recipes/natural_language_processing/chatbot/quadlet/chatbot.kube diff --git a/recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.yaml b/recipes/natural_language_processing/chatbot/quadlet/chatbot.yaml similarity index 100% rename from recipes/natural_language_processing/chatbot/embed-in-bootable-image/quadlet/chatbot.yaml rename to recipes/natural_language_processing/chatbot/quadlet/chatbot.yaml