From 7f55b5a10009a34b18f6c8f2eb80a6877c704bc0 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Fri, 16 May 2025 14:44:17 +0800 Subject: [PATCH] Specify image build list for VisualQnA (#1967) Signed-off-by: chensuyue --- .github/workflows/_run-docker-compose.yml | 10 +++++ ChatQnA/tests/test_compose_mariadb_on_xeon.sh | 2 +- VisualQnA/Dockerfile | 3 +- VisualQnA/docker_image_build/build.yaml | 15 +++++++ VisualQnA/tests/test_compose_on_gaudi.sh | 39 +++++++++++++----- VisualQnA/tests/test_compose_on_rocm.sh | 39 ++++++++++-------- VisualQnA/tests/test_compose_on_xeon.sh | 40 +++++++++++++----- VisualQnA/tests/test_compose_tgi_on_gaudi.sh | 41 +++++++++++-------- VisualQnA/tests/test_compose_tgi_on_xeon.sh | 41 +++++++++++-------- VisualQnA/tests/test_compose_vllm_on_rocm.sh | 38 ++++++++++------- 10 files changed, 181 insertions(+), 87 deletions(-) diff --git a/.github/workflows/_run-docker-compose.yml b/.github/workflows/_run-docker-compose.yml index 24879a975..fa9b560c0 100644 --- a/.github/workflows/_run-docker-compose.yml +++ b/.github/workflows/_run-docker-compose.yml @@ -204,6 +204,10 @@ jobs: if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi echo "Cleaning up images ..." + df -h + sleep 1 + docker system df + sleep 1 if [[ "${{ inputs.hardware }}" == "xeon"* ]]; then docker system prune -a -f else @@ -213,7 +217,13 @@ jobs: docker images --filter reference="opea/comps-base" -q | xargs -r docker rmi && sleep 1s docker system prune -f fi + sleep 5 docker images + sleep 1 + df -h + sleep 1 + docker system df + sleep 1 - name: Publish pipeline artifact if: ${{ !cancelled() }} diff --git a/ChatQnA/tests/test_compose_mariadb_on_xeon.sh b/ChatQnA/tests/test_compose_mariadb_on_xeon.sh index 45f5f99e4..412e32626 100644 --- a/ChatQnA/tests/test_compose_mariadb_on_xeon.sh +++ b/ChatQnA/tests/test_compose_mariadb_on_xeon.sh @@ -140,7 +140,7 @@ function validate_megaservice() { function stop_docker() { cd $WORKPATH/docker_compose/intel/cpu/xeon - docker compose down + docker compose -f compose_mariadb.yaml down } function main() { diff --git a/VisualQnA/Dockerfile b/VisualQnA/Dockerfile index 95936d9c0..988215be2 100644 --- a/VisualQnA/Dockerfile +++ b/VisualQnA/Dockerfile @@ -1,8 +1,9 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +ARG IMAGE_REPO=opea ARG BASE_TAG=latest -FROM opea/comps-base:$BASE_TAG +FROM $IMAGE_REPO/comps-base:$BASE_TAG COPY ./visualqna.py $HOME/visualqna.py diff --git a/VisualQnA/docker_image_build/build.yaml b/VisualQnA/docker_image_build/build.yaml index 11fab7106..e8b124004 100644 --- a/VisualQnA/docker_image_build/build.yaml +++ b/VisualQnA/docker_image_build/build.yaml @@ -5,6 +5,8 @@ services: visualqna: build: args: + IMAGE_REPO: ${REGISTRY:-opea} + BASE_TAG: ${TAG:-latest} http_proxy: ${http_proxy} https_proxy: ${https_proxy} no_proxy: ${no_proxy} @@ -33,4 +35,17 @@ services: build: context: GenAIComps dockerfile: comps/third_parties/vllm/src/Dockerfile.amd_gpu + extends: visualqna image: ${REGISTRY:-opea}/vllm-rocm:${TAG:-latest} + vllm: + build: + context: vllm + dockerfile: docker/Dockerfile.cpu + extends: visualqna + image: ${REGISTRY:-opea}/vllm:${TAG:-latest} + vllm-gaudi: + build: + context: vllm-fork + dockerfile: Dockerfile.hpu + extends: visualqna + image: ${REGISTRY:-opea}/vllm-gaudi:${TAG:-latest} diff --git a/VisualQnA/tests/test_compose_on_gaudi.sh b/VisualQnA/tests/test_compose_on_gaudi.sh index 3fbc8e0ad..237ad3b7d 100644 --- a/VisualQnA/tests/test_compose_on_gaudi.sh +++ b/VisualQnA/tests/test_compose_on_gaudi.sh @@ -18,15 +18,20 @@ LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { + opea_branch=${opea_branch:-"main"} cd $WORKPATH/docker_image_build - git clone --depth 1 --branch main https://github.com/opea-project/GenAIComps.git - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s - git clone https://github.com/HabanaAI/vllm-fork.git - cd ./vllm-fork/ - docker build -f Dockerfile.hpu -t opea/vllm-gaudi:${TAG} --shm-size=128g . --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy - cd .. - rm -rf vllm-fork + git clone https://github.com/HabanaAI/vllm-fork.git && cd vllm-fork + VLLM_FORK_VER=v0.6.6.post1+Gaudi-1.20.0 + git checkout ${VLLM_FORK_VER} &> /dev/null && cd ../ + + service_list="visualqna visualqna-ui lvm nginx vllm-gaudi" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log docker images && sleep 1s } @@ -186,17 +191,31 @@ function stop_docker() { function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - #validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f } diff --git a/VisualQnA/tests/test_compose_on_rocm.sh b/VisualQnA/tests/test_compose_on_rocm.sh index dcdf4e471..ea53c0ab3 100644 --- a/VisualQnA/tests/test_compose_on_rocm.sh +++ b/VisualQnA/tests/test_compose_on_rocm.sh @@ -38,24 +38,17 @@ export MODEL_CACHE=${model_cache:-"/var/opea/multimodalqna-service/data"} function build_docker_images() { opea_branch=${opea_branch:-"main"} - # If the opea_branch isn't main, replace the git clone branch in Dockerfile. - if [[ "${opea_branch}" != "main" ]]; then - cd $WORKPATH - OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git" - NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git" - find . -type f -name "Dockerfile*" | while read -r file; do - echo "Processing file: $file" - sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file" - done - fi - cd $WORKPATH/docker_image_build git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s echo "Build all the images with --no-cache, check docker_image_build.log for details..." - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + service_list="visualqna visualqna-ui lvm nginx" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log - docker pull ghcr.io/huggingface/text-generation-inference:2.4.1-rocm docker images && sleep 1s } @@ -209,17 +202,31 @@ function stop_docker() { function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - #validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f } diff --git a/VisualQnA/tests/test_compose_on_xeon.sh b/VisualQnA/tests/test_compose_on_xeon.sh index 0e645c324..bd5a9c5aa 100644 --- a/VisualQnA/tests/test_compose_on_xeon.sh +++ b/VisualQnA/tests/test_compose_on_xeon.sh @@ -17,22 +17,28 @@ LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { + opea_branch=${opea_branch:-"main"} cd $WORKPATH/docker_image_build - git clone --depth 1 --branch main https://github.com/opea-project/GenAIComps.git - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s + git clone https://github.com/vllm-project/vllm.git && cd vllm + VLLM_VER="v0.8.3" + echo "Check out vLLM tag ${VLLM_VER}" + git checkout ${VLLM_VER} &> /dev/null + cd ../ - docker pull opea/vllm:latest - docker tag opea/vllm:latest opea/vllm:${TAG} + service_list="visualqna visualqna-ui lvm nginx vllm" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log docker images && sleep 1s } function start_services() { cd $WORKPATH/docker_compose/intel/cpu/xeon/ - source ./set_env.sh - sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env - # Start Docker Containers docker compose up -d > ${LOG_PATH}/start_services_with_compose.log @@ -179,17 +185,31 @@ function stop_docker() { function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - #validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f } diff --git a/VisualQnA/tests/test_compose_tgi_on_gaudi.sh b/VisualQnA/tests/test_compose_tgi_on_gaudi.sh index 913d6ed52..495f76481 100644 --- a/VisualQnA/tests/test_compose_tgi_on_gaudi.sh +++ b/VisualQnA/tests/test_compose_tgi_on_gaudi.sh @@ -17,24 +17,17 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { opea_branch=${opea_branch:-"main"} - # If the opea_branch isn't main, replace the git clone branch in Dockerfile. - if [[ "${opea_branch}" != "main" ]]; then - cd $WORKPATH - OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git" - NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git" - find . -type f -name "Dockerfile*" | while read -r file; do - echo "Processing file: $file" - sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file" - done - fi - cd $WORKPATH/docker_image_build git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s echo "Build all the images with --no-cache, check docker_image_build.log for details..." - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + service_list="visualqna visualqna-ui lvm nginx" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log - docker pull ghcr.io/huggingface/tgi-gaudi:2.0.6 docker images && sleep 1s } @@ -200,22 +193,36 @@ function validate_frontend() { function stop_docker() { cd $WORKPATH/docker_compose/intel/hpu/gaudi - docker compose stop && docker compose rm -f + docker compose -f compose_tgi.yaml down } function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - # validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f } diff --git a/VisualQnA/tests/test_compose_tgi_on_xeon.sh b/VisualQnA/tests/test_compose_tgi_on_xeon.sh index d6311719d..a8cc02a23 100644 --- a/VisualQnA/tests/test_compose_tgi_on_xeon.sh +++ b/VisualQnA/tests/test_compose_tgi_on_xeon.sh @@ -17,24 +17,17 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { opea_branch=${opea_branch:-"main"} - # If the opea_branch isn't main, replace the git clone branch in Dockerfile. - if [[ "${opea_branch}" != "main" ]]; then - cd $WORKPATH - OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git" - NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git" - find . -type f -name "Dockerfile*" | while read -r file; do - echo "Processing file: $file" - sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file" - done - fi - cd $WORKPATH/docker_image_build git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s echo "Build all the images with --no-cache, check docker_image_build.log for details..." - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + service_list="visualqna visualqna-ui lvm nginx" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log - docker pull ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu docker images && sleep 1s } @@ -200,22 +193,36 @@ function validate_frontend() { function stop_docker() { cd $WORKPATH/docker_compose/intel/cpu/xeon/ - docker compose stop && docker compose rm -f + docker compose -f compose_tgi.yaml down } function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - # validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f } diff --git a/VisualQnA/tests/test_compose_vllm_on_rocm.sh b/VisualQnA/tests/test_compose_vllm_on_rocm.sh index abf014631..606bb9e25 100644 --- a/VisualQnA/tests/test_compose_vllm_on_rocm.sh +++ b/VisualQnA/tests/test_compose_vllm_on_rocm.sh @@ -37,22 +37,16 @@ export MODEL_CACHE=${model_cache:-"/var/opea/multimodalqna-service/data"} function build_docker_images() { opea_branch=${opea_branch:-"main"} - # If the opea_branch isn't main, replace the git clone branch in Dockerfile. - if [[ "${opea_branch}" != "main" ]]; then - cd $WORKPATH - OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git" - NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git" - find . -type f -name "Dockerfile*" | while read -r file; do - echo "Processing file: $file" - sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file" - done - fi - cd $WORKPATH/docker_image_build git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git + pushd GenAIComps + echo "GenAIComps test commit is $(git rev-parse HEAD)" + docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . + popd && sleep 1s echo "Build all the images with --no-cache, check docker_image_build.log for details..." - docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log + service_list="visualqna visualqna-ui lvm nginx vllm-rocm" + docker compose -f build.yaml build ${service_list} --no-cache > ${LOG_PATH}/docker_image_build.log docker images && sleep 1s } @@ -207,17 +201,31 @@ function stop_docker() { function main() { + echo "::group::stop_docker" stop_docker + echo "::endgroup::" + echo "::group::build_docker_images" if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + echo "::endgroup::" + + echo "::group::start_services" start_services + echo "::endgroup::" + echo "::group::validate_microservices" validate_microservices - validate_megaservice - #validate_frontend + echo "::endgroup::" + echo "::group::validate_megaservice" + validate_megaservice + echo "::endgroup::" + + echo "::group::stop_docker" stop_docker - echo y | docker system prune + echo "::endgroup::" + + docker system prune -f }