Skip to content

Commit

Permalink
fixing passing port as a build argument to containers
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed Apr 13, 2024
1 parent 999093d commit 49a71d3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion model_servers/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endif

.PHONY: build
build:
podman build --squash-all --build-arg $(PORT) -t $(IMAGE) . -f base/Containerfile
podman build --squash-all $${PORT:+--build-arg PORT=$${PORT}} -t $(IMAGE) . -f base/Containerfile

.PHONY: install
install:
Expand Down
3 changes: 2 additions & 1 deletion model_servers/llamacpp_python/base/Containerfile
Original file line number Diff line number Diff line change
@@ -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" ]
2 changes: 2 additions & 0 deletions model_servers/llamacpp_python/cuda/Containerfile
Original file line number Diff line number Diff line change
@@ -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" ]
2 changes: 2 additions & 0 deletions model_servers/llamacpp_python/vulkan/Containerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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" ]
3 changes: 2 additions & 1 deletion model_servers/whispercpp/base/Containerfile
Original file line number Diff line number Diff line change
@@ -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 . && \
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion recipes/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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}} $${PORT:+--build-arg PORT=$${PORT}} -t ${APP_IMAGE} app/

.PHONY: bootc
bootc: quadlet
Expand Down
Original file line number Diff line number Diff line change
@@ -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" ]
Original file line number Diff line number Diff line change
@@ -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" ]

0 comments on commit 49a71d3

Please sign in to comment.