diff --git a/.github/workflows/comps-manual-ci.yaml b/.github/workflows/comps-manual-ci.yaml new file mode 100644 index 000000000..7e307913b --- /dev/null +++ b/.github/workflows/comps-manual-ci.yaml @@ -0,0 +1,54 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Build Specific Comps +on: + workflow_dispatch: + inputs: + comps: + default: 'comps1, comps2' + description: 'List of comma-separated compss to test' + required: true + type: string + scan: + default: true + description: 'Scan all examples with Trivy' + required: false + type: boolean + test: + default: true + description: 'Test Examples' + required: false + type: boolean + publish: + default: false + description: 'Publish Images to Dockerhub' + required: false + type: boolean +permissions: read-all +jobs: + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + steps: + - name: Create Matrix + id: get-matrix + run: | + COMPS=($(echo ${{ github.event.inputs.comps }} | tr ',' ' ')) + COMPS_JSON=$(printf '%s\n' "${COMPS[@]}" | jq -R '.' | jq -sc '.') + echo "matrix=$COMPS_JSON" >> $GITHUB_OUTPUT + container-ci: + needs: [setup-matrix] + strategy: + matrix: + comp: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + experimental: [true] + fail-fast: false + uses: opea-project/genaiexamples/.github/workflows/container-ci.yaml@main + with: + example_dir: ${{ matrix.comp }} + scan: ${{ fromJSON(inputs.scan) }} + test: ${{ fromJSON(inputs.test) }} + publish: ${{ fromJSON(inputs.publish) }} + secrets: inherit diff --git a/.github/workflows/comps-weekly-ci.yaml b/.github/workflows/comps-weekly-ci.yaml new file mode 100644 index 000000000..5d5d4a743 --- /dev/null +++ b/.github/workflows/comps-weekly-ci.yaml @@ -0,0 +1,47 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Weekly Container Tests +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: null + push: + tags: ['**'] # whenever a tag is created/modified +permissions: read-all +jobs: + get-comps: + runs-on: ubuntu-latest + outputs: + comps: ${{ steps.comp-list.outputs.FOLDERS }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + with: + egress-policy: audit + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Output Comp Directories + id: comp-list + run: | + DOCKER_COMPOSE_PATHS=() + for path in $(find comps -name 'docker-compose.yaml'); do + DIR_PATH=$(dirname "$path") + DOCKER_COMPOSE_PATHS+=("${DIR_PATH}") + done + # Convert the array to a JSON array + DOCKER_COMPOSE_PATHS_JSON=$(printf '%s\n' "${DOCKER_COMPOSE_PATHS[@]}" | uniq | jq -R '.' | jq -sc '.') + echo "FOLDERS=$DOCKER_COMPOSE_PATHS_JSON" >> $GITHUB_OUTPUT + pipeline-ci: + needs: [get-comps] + strategy: + matrix: + comp: ${{ fromJson(needs.get-comps.outputs.comps) }} + experimental: [true] + fail-fast: false + uses: opea-project/genaiexamples/.github/workflows/container-ci.yaml@main + with: + example_dir: ${{ matrix.comp }} + scan: false + test: true + publish: false + secrets: inherit diff --git a/.github/workflows/container-build.yml b/.github/workflows/container-build.yml deleted file mode 100644 index b3c2f7bc6..000000000 --- a/.github/workflows/container-build.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -name: Container Build -permissions: read-all -on: - workflow_dispatch: -jobs: - # https://github.com/intel/ai-containers/blob/main/.github/action.yml - build-containers: - runs-on: docker - env: - REGISTRY: ${{ secrets.REGISTRY }} - REPO: ${{ secrets.REPO }} - steps: - - uses: step-security/harden-runner@v2 - with: - egress-policy: audit - - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - path: tei-gaudi - ref: habana-main - repository: huggingface/tei-gaudi - token: ${{ secrets.ACTION_TOKEN }} - - uses: docker/login-action@v3 - with: - registry: ${{ secrets.REGISTRY }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build Containers - run: | - docker compose -p ${GITHUB_RUN_NUMBER} build --no-cache - working-directory: .github/workflows/docker - - name: Print Containers to Summary - run: | - docker compose -p ${GITHUB_RUN_NUMBER} images --format json | jq -r --arg registry "$REGISTRY" '.[] | select(.Repository | contains($registry)) | .Tag' >> $GITHUB_STEP_SUMMARY - - name: Push Containers - run: | - docker compose -p ${GITHUB_RUN_NUMBER} push - working-directory: .github/workflows/docker - - name: Un-Tag Containers - run: | - docker compose -p ${GITHUB_RUN_NUMBER} down --rmi all - working-directory: .github/workflows/docker - - name: Remove Containers - if: always() - run: docker system prune --all --force diff --git a/.github/workflows/docker/docker-compose.yaml b/.github/workflows/docker/docker-compose.yaml deleted file mode 100644 index 4a0b165a7..000000000 --- a/.github/workflows/docker/docker-compose.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -services: - embedding-tei-server: - build: - args: - http_proxy: ${http_proxy} - https_proxy: ${https_proxy} - no_proxy: ${no_proxy} - context: ../../.. - dockerfile: comps/embeddings/langchain/docker/Dockerfile - image: ${REGISTRY}/${REPO}:embedding-tei-server - pull_policy: always - retriever-redis-server: - build: - dockerfile: comps/retrievers/langchain/redis/docker/Dockerfile - extends: embedding-tei-server - image: ${REGISTRY}/${REPO}:retriever-redis-server - reranking-tei-server: - build: - dockerfile: comps/reranks/langchain/docker/Dockerfile - extends: embedding-tei-server - image: ${REGISTRY}/${REPO}:reranking-tei-server - llm-tgi-server: - build: - dockerfile: comps/llms/langchain/docker/Dockerfile - extends: embedding-tei-server - image: ${REGISTRY}/${REPO}:llm-tgi-server - dataprep-redis-server: - build: - dockerfile: comps/dataprep/redis/docker/Dockerfile - extends: embedding-tei-server - image: ${REGISTRY}/${REPO}:dataprep-redis-server - tei-gaudi: - build: - context: ../../../tei-gaudi - dockerfile: Dockerfile-hpu - extends: embedding-tei-server - image: ${REGISTRY}/${REPO}:tei-gaudi diff --git a/comps/asr/README.md b/comps/asr/README.md index c1dacb261..6b4825524 100644 --- a/comps/asr/README.md +++ b/comps/asr/README.md @@ -60,26 +60,8 @@ Alternatively, you can also start the ASR microservice with Docker. ## 2.1 Build Images -### 2.1.1 Whisper Server Image - -- Xeon CPU - -```bash -cd ../.. -docker build -t opea/whisper:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/whisper/Dockerfile . -``` - -- Gaudi2 HPU - -```bash -cd ../.. -docker build -t opea/whisper:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/whisper/Dockerfile_hpu . -``` - -### 2.1.2 ASR Service Image - ```bash -docker build -t opea/asr:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/Dockerfile . +docker compose build ``` ## 2.2 Start Whisper and ASR Service @@ -95,7 +77,7 @@ docker run -p 7066:7066 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$htt - Gaudi2 HPU ```bash -docker run -p 7066:7066 --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/whisper:latest +docker run -p 7066:7066 --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/whisper-hpu:latest ``` ### 2.2.2 Start ASR service diff --git a/comps/asr/docker-compose.yaml b/comps/asr/docker-compose.yaml new file mode 100644 index 000000000..09e8d989a --- /dev/null +++ b/comps/asr/docker-compose.yaml @@ -0,0 +1,23 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +services: + whisper-xeon: + build: + args: + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + no_proxy: ${no_proxy} + context: ../../ + dockerfile: comps/asr/whisper/Dockerfile + image: ${REGISTRY:-opea}/whisper:${GITHUB_RUN_NUMBER:-latest} + whipser-gaudi: + build: + dockerfile: comps/asr/whisper/Dockerfile_hpu + extends: whisper-xeon + image: ${REGISTRY-opea}/whisper-hpu:${GITHUB_RUN_NUMBER:-latest} + asr: + build: + dockerfile: comps/asr/Dockerfile + extends: whisper-xeon + image: ${REGISTRY:-opea}/asr:${GITHUB_RUN_NUMBER:-latest}