diff --git a/model_servers/common/Makefile.common b/model_servers/common/Makefile.common index ee249451c..b0fff2634 100644 --- a/model_servers/common/Makefile.common +++ b/model_servers/common/Makefile.common @@ -10,7 +10,7 @@ endif .PHONY: build build: - podman build --squash-all --build-arg $(PORT) -t $(IMAGE) . -f base/Containerfile + podman build --squash-all --build-arg PORT=$(PORT) -t $(IMAGE) . -f base/Containerfile .PHONY: install install: diff --git a/model_servers/llamacpp_python/base/Containerfile b/model_servers/llamacpp_python/base/Containerfile index e32290f2f..bb967dcd5 100644 --- a/model_servers/llamacpp_python/base/Containerfile +++ b/model_servers/llamacpp_python/base/Containerfile @@ -1,6 +1,7 @@ FROM registry.access.redhat.com/ubi9/python-311:1-52 +ARG PORT WORKDIR /locallm COPY src . RUN pip install --no-cache-dir --verbose -r ./requirements.txt -EXPOSE 8001 +EXPOSE $PORT ENTRYPOINT [ "sh", "./run.sh" ] diff --git a/model_servers/llamacpp_python/cuda/Containerfile b/model_servers/llamacpp_python/cuda/Containerfile index ed8ff3754..e54c00838 100644 --- a/model_servers/llamacpp_python/cuda/Containerfile +++ b/model_servers/llamacpp_python/cuda/Containerfile @@ -1,8 +1,10 @@ FROM quay.io/opendatahub/workbench-images:cuda-ubi9-python-3.9-20231206 +ARG PORT WORKDIR /locallm COPY src . RUN pip install --upgrade pip ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on" ENV FORCE_CMAKE=1 RUN pip install --no-cache-dir --upgrade -r /locallm/requirements.txt +EXPOSE $PORT ENTRYPOINT [ "sh", "run.sh" ] \ No newline at end of file diff --git a/model_servers/llamacpp_python/vulkan/Containerfile b/model_servers/llamacpp_python/vulkan/Containerfile index 9163fc096..714df79f5 100644 --- a/model_servers/llamacpp_python/vulkan/Containerfile +++ b/model_servers/llamacpp_python/vulkan/Containerfile @@ -1,5 +1,6 @@ FROM registry.access.redhat.com/ubi9/python-311:1-52 USER 0 +ARG PORT RUN dnf install -y python3-dnf-plugin-versionlock && \ dnf copr enable -y slp/mesa-krunkit epel-9-aarch64 && \ dnf install -y mesa-vulkan-drivers-23.3.3-101.el9.aarch64 && \ @@ -12,4 +13,5 @@ RUN pip install --upgrade pip ENV CMAKE_ARGS="-DLLAMA_VULKAN=on" ENV FORCE_CMAKE=1 RUN pip install --no-cache-dir --upgrade -r /locallm/requirements.txt +EXPOSE $PORT ENTRYPOINT [ "sh", "run.sh" ] diff --git a/model_servers/whispercpp/base/Containerfile b/model_servers/whispercpp/base/Containerfile index fa9dff1e2..a924c15f4 100644 --- a/model_servers/whispercpp/base/Containerfile +++ b/model_servers/whispercpp/base/Containerfile @@ -1,5 +1,5 @@ FROM registry.access.redhat.com/ubi9/ubi:latest as builder - +ARG PORT WORKDIR /app RUN dnf install -y git make gcc gcc-c++ RUN mkdir whisper && cd whisper && git clone https://github.com/ggerganov/whisper.cpp.git . && \ @@ -21,4 +21,5 @@ COPY --from=mwader/static-ffmpeg:6.1.1 /ffprobe /bin/ COPY src /app/ ENV AUDIO_FILE=/app/jfk.wav +EXPOSE $PORT ENTRYPOINT ["sh", "run.sh"] diff --git a/recipes/common/Makefile.common b/recipes/common/Makefile.common index 712dde49c..389544d80 100644 --- a/recipes/common/Makefile.common +++ b/recipes/common/Makefile.common @@ -75,7 +75,7 @@ install: .PHONY: build build: - podman build --squash-all $${ARCH:+--arch $${ARCH}} $${FROM:+--from $${FROM}} -t ${APP_IMAGE} app/ + podman build --squash-all $${ARCH:+--arch $${ARCH}} $${FROM:+--from $${FROM}} --build-arg PORT=$(PORT) -t ${APP_IMAGE} app/ .PHONY: bootc bootc: quadlet @@ -89,6 +89,7 @@ bootc: quadlet --build-arg APP_IMAGE=$(APP_IMAGE) \ --build-arg SERVER_IMAGE=$(SERVER_IMAGE) \ --build-arg "SSHPUBKEY=$(SSH_PUBKEY)" \ + --build-arg PORT=$(PORT) \ -v /etc/containers/policy.json:/etc/containers/policy.json \ -f bootc/$(CONTAINERFILE) \ -t ${BOOTC_IMAGE} bootc @@ -101,7 +102,7 @@ bootc: quadlet .PHONY: bootc-run bootc-run: - podman run -d --rm --name $(APP)-bootc -p 8080:8501 --privileged \ + podman run -d --rm --name $(APP)-bootc -p 8080:$(PORT) --privileged \ $${AUTH_JSON:+-v $${AUTH_JSON}:/run/containers/0/auth.json} \ $(BOOTC_IMAGE) /sbin/init diff --git a/recipes/computer_vision/object_detection/model_server/Containerfile b/recipes/computer_vision/object_detection/model_server/Containerfile index d7b57353b..835038079 100644 --- a/recipes/computer_vision/object_detection/model_server/Containerfile +++ b/recipes/computer_vision/object_detection/model_server/Containerfile @@ -1,8 +1,9 @@ FROM registry.access.redhat.com/ubi9/python-311:1-52 +ARG PORT WORKDIR /locallm COPY requirements.txt /locallm/requirements.txt RUN pip install --upgrade pip && \ pip install --no-cache-dir --upgrade -r requirements.txt -COPY object_detection_server.py object_detection_server.py -EXPOSE 8000 +COPY ../src/object_detection_server.py object_detection_server.py +EXPOSE $PORT ENTRYPOINT [ "uvicorn", "object_detection_server:app", "--host", "0.0.0.0" ] diff --git a/recipes/natural_language_processing/chatbot/app/Containerfile b/recipes/natural_language_processing/chatbot/app/Containerfile index 13a31118f..0fbed69c9 100644 --- a/recipes/natural_language_processing/chatbot/app/Containerfile +++ b/recipes/natural_language_processing/chatbot/app/Containerfile @@ -1,8 +1,9 @@ FROM registry.access.redhat.com/ubi9/python-311:1-52 +ARG PORT WORKDIR /chat COPY requirements.txt . RUN pip install --upgrade pip RUN pip install --no-cache-dir --upgrade -r /chat/requirements.txt COPY chatbot_ui.py . -EXPOSE 8501 +EXPOSE $PORT ENTRYPOINT [ "streamlit", "run", "chatbot_ui.py" ] diff --git a/recipes/natural_language_processing/chatbot/bootc/Containerfile b/recipes/natural_language_processing/chatbot/bootc/Containerfile index 31af5575c..d8474e7ad 100644 --- a/recipes/natural_language_processing/chatbot/bootc/Containerfile +++ b/recipes/natural_language_processing/chatbot/bootc/Containerfile @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -41,4 +42,6 @@ RUN podman pull --root /usr/lib/containers/storage ${SERVER_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${APP_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${MODEL_IMAGE} +EXPOSE $PORT + RUN podman system reset --force 2>/dev/null diff --git a/recipes/natural_language_processing/chatbot/bootc/Containerfile.nocache b/recipes/natural_language_processing/chatbot/bootc/Containerfile.nocache index 563ea2f82..a4ac96dcf 100644 --- a/recipes/natural_language_processing/chatbot/bootc/Containerfile.nocache +++ b/recipes/natural_language_processing/chatbot/bootc/Containerfile.nocache @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -18,5 +19,7 @@ ARG RECIPE=chatbot # Add quadlet files to setup system to automatically run AI application on boot COPY build/${RECIPE}.image build/${RECIPE}.kube build/${RECIPE}.yaml /usr/share/containers/systemd +EXPOSE $PORT + # Added for running as an OCI Container to prevent Overlay on Overlay issues. VOLUME /var/lib/containers diff --git a/recipes/natural_language_processing/codegen/bootc/Containerfile b/recipes/natural_language_processing/codegen/bootc/Containerfile index 98bef93c2..682198c35 100644 --- a/recipes/natural_language_processing/codegen/bootc/Containerfile +++ b/recipes/natural_language_processing/codegen/bootc/Containerfile @@ -8,6 +8,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT RUN set -eu; mkdir -p /usr/ssh && \ echo 'AuthorizedKeysFile /usr/ssh/%u.keys .ssh/authorized_keys .ssh/authorized_keys2' >> /etc/ssh/sshd_config.d/30-auth-system.conf && \ @@ -42,4 +43,6 @@ RUN podman pull --root /usr/lib/containers/storage ${SERVER_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${APP_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${MODEL_IMAGE} +EXPOSE $PORT + RUN podman system reset --force 2>/dev/null diff --git a/recipes/natural_language_processing/codegen/bootc/Containerfile.nocache b/recipes/natural_language_processing/codegen/bootc/Containerfile.nocache index 96ea3f44c..2f26a1012 100644 --- a/recipes/natural_language_processing/codegen/bootc/Containerfile.nocache +++ b/recipes/natural_language_processing/codegen/bootc/Containerfile.nocache @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -18,5 +19,7 @@ ARG RECIPE=codegen # Add quadlet files to setup system to automatically run AI application on boot COPY build/${RECIPE}.image build/${RECIPE}.kube build/${RECIPE}.yaml /usr/share/containers/systemd +EXPOSE $PORT + # Added for running as an OCI Container to prevent Overlay on Overlay issues. VOLUME /var/lib/containers diff --git a/recipes/natural_language_processing/rag/bootc/Containerfile b/recipes/natural_language_processing/rag/bootc/Containerfile index b7d7d8615..d935a39b7 100644 --- a/recipes/natural_language_processing/rag/bootc/Containerfile +++ b/recipes/natural_language_processing/rag/bootc/Containerfile @@ -5,8 +5,8 @@ # 'make bootc' FROM quay.io/centos-bootc/centos-bootc:stream9 - ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -44,4 +44,6 @@ RUN podman pull --root /usr/lib/containers/storage ${APP_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${MODEL_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${CHROMADBImage} +EXPOSE $PORT + RUN podman system reset --force 2>/dev/null diff --git a/recipes/natural_language_processing/rag/bootc/Containerfile.nocache b/recipes/natural_language_processing/rag/bootc/Containerfile.nocache index 126286fd4..e14843591 100644 --- a/recipes/natural_language_processing/rag/bootc/Containerfile.nocache +++ b/recipes/natural_language_processing/rag/bootc/Containerfile.nocache @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -18,5 +19,7 @@ ARG RECIPE=rag # Add quadlet files to setup system to automatically run AI application on boot COPY build/${RECIPE}.image build/${RECIPE}.kube build/${RECIPE}.yaml /usr/share/containers/systemd +EXPOSE $PORT + # Added for running as an OCI Container to prevent Overlay on Overlay issues. VOLUME /var/lib/containers diff --git a/recipes/natural_language_processing/summarizer/bootc/Containerfile b/recipes/natural_language_processing/summarizer/bootc/Containerfile index c335388c9..05474017b 100644 --- a/recipes/natural_language_processing/summarizer/bootc/Containerfile +++ b/recipes/natural_language_processing/summarizer/bootc/Containerfile @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -41,4 +42,6 @@ RUN podman pull --root /usr/lib/containers/storage ${SERVER_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${APP_IMAGE} RUN podman pull --root /usr/lib/containers/storage ${MODEL_IMAGE} +EXPOSE $PORT + RUN podman system reset --force 2>/dev/null diff --git a/recipes/natural_language_processing/summarizer/bootc/Containerfile.nocache b/recipes/natural_language_processing/summarizer/bootc/Containerfile.nocache index 727b9cee3..61b0054f4 100644 --- a/recipes/natural_language_processing/summarizer/bootc/Containerfile.nocache +++ b/recipes/natural_language_processing/summarizer/bootc/Containerfile.nocache @@ -6,6 +6,7 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ARG SSHPUBKEY +ARG PORT # The --build-arg "SSHPUBKEY=$(cat ~/.ssh/id_rsa.pub)" option inserts your # public key into the image, allowing root access via ssh. @@ -18,5 +19,7 @@ ARG RECIPE=summarizer # Add quadlet files to setup system to automatically run AI application on boot COPY build/${RECIPE}.image build/${RECIPE}.kube build/${RECIPE}.yaml /usr/share/containers/systemd +EXPOSE $PORT + # Added for running as an OCI Container to prevent Overlay on Overlay issues. VOLUME /var/lib/containers