diff --git a/.github/workflows/dockers-agent-faiss-image.yml b/.github/workflows/dockers-agent-faiss-image.yml new file mode 100644 index 00000000000..297aca6ea90 --- /dev/null +++ b/.github/workflows/dockers-agent-faiss-image.yml @@ -0,0 +1,84 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +name: "Build docker image: agent-faiss" +on: + push: + branches: + - "main" + - "release/v*.*" + - "!release/v*.*.*" + tags: + - "*.*.*" + - "v*.*.*" + - "*.*.*-*" + - "v*.*.*-*" + paths: + - ".github/actions/docker-build/actions.yaml" + - ".github/workflows/_docker-image.yaml" + - ".github/workflows/dockers-agent-faiss-image.yml" + - "go.mod" + - "go.sum" + - "internal/**" + - "!internal/**/*_test.go" + - "!internal/db/**" + - "!internal/k8s/**" + - "apis/grpc/**" + - "pkg/agent/core/faiss/**" + - "cmd/agent/core/faiss/**" + - "dockers/agent/core/faiss/Dockerfile" + - "versions/GO_VERSION" + - "versions/FAISS_VERSION" + pull_request: + paths: + - ".github/actions/docker-build/actions.yaml" + - ".github/workflows/_docker-image.yaml" + - ".github/workflows/dockers-agent-faiss-image.yml" + - "go.mod" + - "go.sum" + - "internal/**" + - "!internal/**/*_test.go" + - "!internal/db/**" + - "!internal/k8s/**" + - "apis/grpc/**" + - "pkg/agent/core/faiss/**" + - "cmd/agent/core/faiss/**" + - "dockers/agent/core/faiss/Dockerfile" + - "versions/GO_VERSION" + - "versions/FAISS_VERSION" + pull_request_target: + paths: + - ".github/actions/docker-build/actions.yaml" + - ".github/workflows/_docker-image.yaml" + - ".github/workflows/dockers-agent-faiss-image.yml" + - "go.mod" + - "go.sum" + - "internal/**" + - "!internal/**/*_test.go" + - "!internal/db/**" + - "!internal/k8s/**" + - "apis/grpc/**" + - "pkg/agent/core/faiss/**" + - "cmd/agent/core/faiss/**" + - "dockers/agent/core/faiss/Dockerfile" + - "versions/GO_VERSION" + - "versions/FAISS_VERSION" +jobs: + build: + uses: ./.github/workflows/_docker-image.yaml + with: + target: agent-faiss + platforms: linux/amd64 + secrets: inherit diff --git a/.github/workflows/dockers-agent-ngt-image.yml b/.github/workflows/dockers-agent-ngt-image.yml index f786cc5bce7..64ab26c4701 100644 --- a/.github/workflows/dockers-agent-ngt-image.yml +++ b/.github/workflows/dockers-agent-ngt-image.yml @@ -80,4 +80,5 @@ jobs: uses: ./.github/workflows/_docker-image.yaml with: target: agent-ngt + platforms: linux/amd64,linux/arm64 secrets: inherit diff --git a/.github/workflows/dockers-helm-operator-image.yml b/.github/workflows/dockers-helm-operator-image.yml index 1050a6e56bd..1c9aba06169 100644 --- a/.github/workflows/dockers-helm-operator-image.yml +++ b/.github/workflows/dockers-helm-operator-image.yml @@ -68,4 +68,5 @@ jobs: uses: ./.github/workflows/_docker-image.yaml with: target: operator/helm + platforms: linux/amd64,linux/arm64 secrets: inherit diff --git a/dockers/agent/core/faiss/Dockerfile b/dockers/agent/core/faiss/Dockerfile index f037f4b94fb..1bea7388afc 100644 --- a/dockers/agent/core/faiss/Dockerfile +++ b/dockers/agent/core/faiss/Dockerfile @@ -37,6 +37,8 @@ ENV REPO vald ENV PKG agent/core/faiss ENV PKG_INTERNAL agent/internal ENV APP_NAME faiss +ENV AARCH aarch_64 +ENV XARCH x86_64 # skipcq: DOK-DL3008 RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -50,6 +52,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ intel-mkl \ unzip \ upx \ + && if [ "${TARGETARCH}" = "amd64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${XARCH}-${TARGETOS}-gnu; \ + export CC=${XARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + elif [ "${TARGETARCH}" = "arm64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${AARCH}-${TARGETOS}-gnu; \ + export CC=${AARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + fi; \ + && ldconfig \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/dockers/agent/core/ngt/Dockerfile b/dockers/agent/core/ngt/Dockerfile index 8bdb671c5e0..9bb0ad2152f 100644 --- a/dockers/agent/core/ngt/Dockerfile +++ b/dockers/agent/core/ngt/Dockerfile @@ -37,6 +37,8 @@ ENV REPO vald ENV PKG agent/core/ngt ENV PKG_INTERNAL agent/internal ENV APP_NAME ngt +ENV AARCH aarch_64 +ENV XARCH x86_64 # skipcq: DOK-DL3008 RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -52,6 +54,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libopenblas-dev \ unzip \ upx \ + && if [ "${TARGETARCH}" = "amd64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${XARCH}-${TARGETOS}-gnu; \ + export CC=${XARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + elif [ "${TARGETARCH}" = "arm64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${AARCH}-${TARGETOS}-gnu; \ + export CC=${AARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + fi; \ + && ldconfig \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/dockers/operator/helm/Dockerfile b/dockers/operator/helm/Dockerfile index bc9ac58900a..234ad0f94fb 100644 --- a/dockers/operator/helm/Dockerfile +++ b/dockers/operator/helm/Dockerfile @@ -48,6 +48,8 @@ ENV PATH ${PATH}:${GOROOT}/bin:${GOPATH}/bin ENV ORG vdaas ENV REPO vald ENV APP_NAME helm-operator +ENV AARCH aarch_64 +ENV XARCH x86_64 # skipcq: DOK-DL3008 RUN apt-get clean \ @@ -62,6 +64,16 @@ RUN apt-get clean \ curl \ upx \ git \ + && if [ "${TARGETARCH}" = "amd64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${XARCH}-${TARGETOS}-gnu; \ + export CC=${XARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + elif [ "${TARGETARCH}" = "arm64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${AARCH}-${TARGETOS}-gnu; \ + export CC=${AARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + fi; \ + && ldconfig \ && apt-get clean \ && rm -rf \ /var/lib/apt/lists/* \ diff --git a/dockers/tools/benchmark/job/Dockerfile b/dockers/tools/benchmark/job/Dockerfile index 4edb54929f3..d248aa9171c 100644 --- a/dockers/tools/benchmark/job/Dockerfile +++ b/dockers/tools/benchmark/job/Dockerfile @@ -45,6 +45,8 @@ ENV PKG tools/benchmark/${APP_NAME} ENV BUILD_DIR=/usr/local ENV LIB_DIR=/usr/local/lib ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIB_DIR}:/lib +ENV AARCH aarch_64 +ENV XARCH x86_64 # skipcq: DOK-DL3008, DOK-DL3003 RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -54,6 +56,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ upx \ g++ \ git \ + && if [ "${TARGETARCH}" = "amd64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${XARCH}-${TARGETOS}-gnu; \ + export CC=${XARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + elif [ "${TARGETARCH}" = "arm64" ] ; then \ + apt install -y --no-install-recommends --fix-missing gcc-${AARCH}-${TARGETOS}-gnu; \ + export CC=${AARCH}-${TARGETOS}-gnu-gcc; \ + export CC_FOR_TARGET=${CC}; \ + fi; \ && ldconfig \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \