Skip to content

Commit 2204fe8

Browse files
authored
Enable base image build in CI/CD (#1669)
Signed-off-by: chensuyue <suyue.chen@intel.com>
1 parent b50dd8f commit 2204fe8

9 files changed

+89
-55
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Build Comps Base Image
5+
permissions: read-all
6+
on:
7+
workflow_call:
8+
inputs:
9+
node:
10+
required: true
11+
type: string
12+
build:
13+
default: true
14+
required: false
15+
type: boolean
16+
tag:
17+
default: "latest"
18+
required: false
19+
type: string
20+
opea_branch:
21+
default: "main"
22+
required: false
23+
type: string
24+
inject_commit:
25+
default: false
26+
required: false
27+
type: boolean
28+
29+
jobs:
30+
pre-build-image-check:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
should_skip: ${{ steps.check-skip.outputs.should_skip }}
34+
steps:
35+
- name: Check if job should be skipped
36+
id: check-skip
37+
run: |
38+
should_skip=false
39+
if [[ "${{ inputs.node }}" == "gaudi3" || "${{ inputs.node }}" == "rocm" || "${{ inputs.node }}" == "arc" ]]; then
40+
should_skip=true
41+
fi
42+
echo "should_skip=$should_skip"
43+
echo "should_skip=$should_skip" >> $GITHUB_OUTPUT
44+
45+
build-images:
46+
needs: [ pre-build-image-check ]
47+
if: ${{ needs.pre-build-image-check.outputs.should_skip == 'false' && fromJSON(inputs.build) }}
48+
runs-on: "docker-build-${{ inputs.node }}"
49+
steps:
50+
- name: Clean Up Working Directory
51+
run: sudo rm -rf ${{github.workspace}}/*
52+
53+
- name: Clone Required Repo
54+
run: |
55+
git clone --depth 1 --branch ${{ inputs.opea_branch }} https://github.com/opea-project/GenAIComps.git
56+
cd GenAIComps && git rev-parse HEAD && cd ../ && ls -l
57+
58+
- name: Build Image
59+
uses: opea-project/validation/actions/image-build@main
60+
with:
61+
work_dir: ${{ github.workspace }}/GenAIComps
62+
docker_compose_path: ${{ github.workspace }}/GenAIComps/.github/workflows/docker/compose/base-compose.yaml
63+
registry: ${OPEA_IMAGE_REPO}opea
64+
inject_commit: ${{ inputs.inject_commit }}
65+
tag: ${{ inputs.tag }}

.github/workflows/manual-example-workflow.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ on:
2020
description: "Tag to apply to images"
2121
required: true
2222
type: string
23-
# deploy_gmc:
24-
# default: false
25-
# description: 'Whether to deploy gmc'
26-
# required: true
27-
# type: boolean
2823
build:
2924
default: true
3025
description: 'Build test required images for Examples'
@@ -40,11 +35,6 @@ on:
4035
description: 'Test examples with helm charts'
4136
required: false
4237
type: boolean
43-
# test_gmc:
44-
# default: false
45-
# description: 'Test examples with gmc'
46-
# required: false
47-
# type: boolean
4838
opea_branch:
4939
default: "main"
5040
description: 'OPEA branch for image build'
@@ -79,23 +69,20 @@ jobs:
7969
nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.')
8070
echo "nodes=$nodes_json" >> $GITHUB_OUTPUT
8171
82-
build-deploy-gmc:
72+
build-comps-base:
8373
needs: [get-test-matrix]
84-
if: false
85-
#${{ fromJSON(inputs.deploy_gmc) }}
8674
strategy:
8775
matrix:
8876
node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
89-
fail-fast: false
90-
uses: ./.github/workflows/_gmc-workflow.yml
77+
uses: ./.github/workflows/_build_comps_base_image.yml
9178
with:
9279
node: ${{ matrix.node }}
80+
build: ${{ fromJSON(inputs.build) }}
9381
tag: ${{ inputs.tag }}
9482
opea_branch: ${{ inputs.opea_branch }}
95-
secrets: inherit
9683

9784
run-examples:
98-
needs: [get-test-matrix] #[get-test-matrix, build-deploy-gmc]
85+
needs: [get-test-matrix, build-comps-base]
9986
strategy:
10087
matrix:
10188
example: ${{ fromJson(needs.get-test-matrix.outputs.examples) }}
@@ -109,7 +96,6 @@ jobs:
10996
build: ${{ fromJSON(inputs.build) }}
11097
test_compose: ${{ fromJSON(inputs.test_compose) }}
11198
test_helmchart: ${{ fromJSON(inputs.test_helmchart) }}
112-
# test_gmc: ${{ fromJSON(inputs.test_gmc) }}
11399
opea_branch: ${{ inputs.opea_branch }}
114100
inject_commit: ${{ inputs.inject_commit }}
115101
use_model_cache: ${{ inputs.use_model_cache }}

.github/workflows/nightly-docker-build-publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
echo "TAG=$TAG" >> $GITHUB_OUTPUT
3333
echo "PUBLISH_TAGS=$PUBLISH_TAGS" >> $GITHUB_OUTPUT
3434
35+
build-comps-base:
36+
needs: [get-build-matrix]
37+
uses: ./.github/workflows/_build_comps_base_image.yml
38+
with:
39+
node: gaudi
40+
3541
build-and-test:
3642
needs: get-build-matrix
3743
if: ${{ needs.get-build-matrix.outputs.examples_json != '' }}

.github/workflows/weekly-update-images.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Copyright (C) 2024 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4-
name: Weekly update base images and 3rd party images
4+
name: Weekly update 3rd party images
55

66
on:
7-
schedule:
8-
- cron: "0 0 * * 0"
97
workflow_dispatch:
108

119
permissions:

DocSum/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Copyright (C) 2024 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4+
ARG IMAGE_REPO=opea
45
ARG BASE_TAG=latest
5-
FROM opea/comps-base:$BASE_TAG
6+
FROM $IMAGE_REPO/comps-base:$BASE_TAG
67

78
USER root
89
# FFmpeg needed for media processing

DocSum/docker_image_build/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
docsum:
66
build:
77
args:
8+
IMAGE_REPO: ${REGISTRY}
9+
BASE_TAG: ${TAG}
810
http_proxy: ${http_proxy}
911
https_proxy: ${https_proxy}
1012
no_proxy: ${no_proxy}

DocSum/tests/test_compose_on_gaudi.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,11 @@ ROOT_FOLDER=$(dirname "$(readlink -f "$0")")
3939

4040
function build_docker_images() {
4141
opea_branch=${opea_branch:-"main"}
42-
# If the opea_branch isn't main, replace the git clone branch in Dockerfile.
43-
if [[ "${opea_branch}" != "main" ]]; then
44-
cd $WORKPATH
45-
OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git"
46-
NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git"
47-
find . -type f -name "Dockerfile*" | while read -r file; do
48-
echo "Processing file: $file"
49-
sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file"
50-
done
51-
fi
52-
5342
cd $WORKPATH/docker_image_build
5443
git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git
44+
pushd GenAIComps
45+
docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
46+
popd && sleep 1s
5547

5648
echo "Build all the images with --no-cache, check docker_image_build.log for details..."
5749
service_list="docsum docsum-gradio-ui whisper llm-docsum"

DocSum/tests/test_compose_on_rocm.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,11 @@ export LOGFLAG=True
3535

3636
function build_docker_images() {
3737
opea_branch=${opea_branch:-"main"}
38-
# If the opea_branch isn't main, replace the git clone branch in Dockerfile.
39-
if [[ "${opea_branch}" != "main" ]]; then
40-
cd $WORKPATH
41-
OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git"
42-
NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git"
43-
find . -type f -name "Dockerfile*" | while read -r file; do
44-
echo "Processing file: $file"
45-
sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file"
46-
done
47-
fi
48-
4938
cd $WORKPATH/docker_image_build
5039
git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git
40+
pushd GenAIComps
41+
docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
42+
popd && sleep 1s
5143

5244
echo "Build all the images with --no-cache, check docker_image_build.log for details..."
5345
service_list="docsum docsum-gradio-ui whisper llm-docsum"

DocSum/tests/test_compose_on_xeon.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,11 @@ ROOT_FOLDER=$(dirname "$(readlink -f "$0")")
3838

3939
function build_docker_images() {
4040
opea_branch=${opea_branch:-"main"}
41-
# If the opea_branch isn't main, replace the git clone branch in Dockerfile.
42-
if [[ "${opea_branch}" != "main" ]]; then
43-
cd $WORKPATH
44-
OLD_STRING="RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git"
45-
NEW_STRING="RUN git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git"
46-
find . -type f -name "Dockerfile*" | while read -r file; do
47-
echo "Processing file: $file"
48-
sed -i "s|$OLD_STRING|$NEW_STRING|g" "$file"
49-
done
50-
fi
51-
5241
cd $WORKPATH/docker_image_build
5342
git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git
43+
pushd GenAIComps
44+
docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
45+
popd && sleep 1s
5446

5547
echo "Build all the images with --no-cache, check docker_image_build.log for details..."
5648
service_list="docsum docsum-gradio-ui whisper llm-docsum"

0 commit comments

Comments
 (0)