From 2f158e27d85c4b98fd6b0188eec9cb5a31b347de Mon Sep 17 00:00:00 2001 From: zhihang Date: Sat, 26 Jul 2025 09:19:42 +0000 Subject: [PATCH] update Translation Signed-off-by: zhihang --- .../translation-ui/1.2/24.03-lts/Dockerfile | 20 ++++--- AI/opea/translation/1.2/24.03-lts/Dockerfile | 57 +++++++++++++------ 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/AI/opea/translation-ui/1.2/24.03-lts/Dockerfile b/AI/opea/translation-ui/1.2/24.03-lts/Dockerfile index d26baecf..1d5b5300 100644 --- a/AI/opea/translation-ui/1.2/24.03-lts/Dockerfile +++ b/AI/opea/translation-ui/1.2/24.03-lts/Dockerfile @@ -1,21 +1,27 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +ARG BASE=openeuler/node:20.11.1-oe2403lts +ARG VERSION=v1.2 + # Use node 20.11.1 as the base image -FROM openeuler/openeuler:24.03-lts +FROM $BASE + +ARG VERSION # Update package manager and install Git RUN yum update -y && \ - yum install -y \ - git \ - npm + yum install -y git && \ + yum clean all && \ + rm -rf /var/cache/yum WORKDIR /home/user -# Copy the front-end code repository -RUN git clone -b v1.2 https://github.com/opea-project/GenAIExamples.git +ARG GENAIEXAMPLES_REPO=https://github.com/opea-project/GenAIExamples.git +RUN git clone -b $VERSION $GENAIEXAMPLES_REPO && \ + cp -r GenAIExamples/Translation/ui/svelte /home/user/svelte && \ + rm -rf GenAIExamples -RUN cp -r GenAIExamples/Translation/ui/svelte /home/user/svelte # Set the working directory WORKDIR /home/user/svelte diff --git a/AI/opea/translation/1.2/24.03-lts/Dockerfile b/AI/opea/translation/1.2/24.03-lts/Dockerfile index 38b072eb..d171293a 100644 --- a/AI/opea/translation/1.2/24.03-lts/Dockerfile +++ b/AI/opea/translation/1.2/24.03-lts/Dockerfile @@ -1,34 +1,59 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +ARG BASE=openeuler/python:3.11.13-oe2403lts +ARG VERSION=v1.2 + # Stage 1: base setup used by other stages -FROM openeuler/openeuler:24.03-lts +FROM $BASE AS base # get security updates -RUN yum update -y && \ +RUN yum update -y && \ yum install -y \ - python python-pip \ - git + shadow && \ + yum clean all && \ + rm -rf /var/cache/yum + +ENV HOME=/home/user RUN useradd -m -s /bin/bash user && \ - mkdir -p /home/user && \ - chown -R user /home/user + mkdir -p $HOME && \ + chown -R user $HOME -WORKDIR /home/user +WORKDIR $HOME -RUN git clone -b v1.2 https://github.com/opea-project/GenAIComps.git -WORKDIR /home/user/GenAIComps -RUN pip install --no-cache-dir --upgrade pip setuptools && \ - pip install --no-cache-dir -r /home/user/GenAIComps/requirements.txt -WORKDIR /home/user +# Stage 2: latest GenAIComps sources +FROM base AS git -ENV PYTHONPATH=$PYTHONPATH:/home/user/GenAIComps +ARG VERSION -USER user +RUN yum update -y && \ + yum install -y git && \ + yum clean all && \ + rm -rf /var/cache/yum + +ARG GENAICOMPS_REPO=https://github.com/opea-project/GenAIComps.git +RUN git clone -b $VERSION $GENAICOMPS_REPO + +ARG GENAIEXAMPLES_REPO=https://github.com/opea-project/GenAIExamples.git +RUN git clone -b $VERSION $GENAIEXAMPLES_REPO -RUN git clone -b v1.2 https://github.com/opea-project/GenAIExamples.git +# Stage 3: common layer shared by services using GenAIComps +FROM base AS comps-base -RUN cp -r GenAIExamples/Translation/translation.py /home/user/translation.py +# copy just relevant parts +COPY --from=git $HOME/GenAIComps/comps $HOME/GenAIComps/comps +COPY --from=git $HOME/GenAIComps/*.* $HOME/GenAIComps/LICENSE $HOME/GenAIComps/ +COPY --from=git $HOME/GenAIExamples/Translation/translation.py $HOME/translation.py + +WORKDIR $HOME/GenAIComps +RUN pip install --no-cache-dir --upgrade pip setuptools && \ + pip install --no-cache-dir -r $HOME/GenAIComps/requirements.txt +WORKDIR $HOME + +ENV PYTHONPATH=$PYTHONPATH:$HOME/GenAIComps + +USER user ENTRYPOINT ["python", "translation.py"] \ No newline at end of file -- Gitee