Use GenAIComp base image to simplify Dockerfiles - part 3/4 (#1671)
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
This commit is contained in:
@@ -1,50 +1,8 @@
|
|||||||
# Copyright (C) 2024 Intel Corporation
|
# Copyright (C) 2024 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Stage 1: base setup used by other stages
|
ARG BASE_TAG=latest
|
||||||
FROM python:3.11-slim AS base
|
FROM opea/comps-base:$BASE_TAG
|
||||||
|
|
||||||
# get security updates
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV HOME=/home/user
|
|
||||||
|
|
||||||
RUN useradd -m -s /bin/bash user && \
|
|
||||||
mkdir -p $HOME && \
|
|
||||||
chown -R user $HOME
|
|
||||||
|
|
||||||
WORKDIR $HOME
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 2: latest GenAIComps sources
|
|
||||||
FROM base AS git
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
|
||||||
RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 3: common layer shared by services using GenAIComps
|
|
||||||
FROM base AS comps-base
|
|
||||||
|
|
||||||
# copy just relevant parts
|
|
||||||
COPY --from=git $HOME/GenAIComps/comps $HOME/GenAIComps/comps
|
|
||||||
COPY --from=git $HOME/GenAIComps/*.* $HOME/GenAIComps/LICENSE $HOME/GenAIComps/
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 4: unique part
|
|
||||||
FROM comps-base
|
|
||||||
|
|
||||||
ENV LANG=C.UTF-8
|
|
||||||
|
|
||||||
COPY ./codegen.py $HOME/codegen.py
|
COPY ./codegen.py $HOME/codegen.py
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,8 @@
|
|||||||
# Copyright (C) 2024 Intel Corporation
|
# Copyright (C) 2024 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Stage 1: base setup used by other stages
|
ARG BASE_TAG=latest
|
||||||
FROM python:3.11-slim AS base
|
FROM opea/comps-base:$BASE_TAG
|
||||||
|
|
||||||
# get security updates
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV HOME=/home/user
|
|
||||||
|
|
||||||
RUN useradd -m -s /bin/bash user && \
|
|
||||||
mkdir -p $HOME && \
|
|
||||||
chown -R user $HOME
|
|
||||||
|
|
||||||
WORKDIR $HOME
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 2: latest GenAIComps sources
|
|
||||||
FROM base AS git
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
|
||||||
RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 3: common layer shared by services using GenAIComps
|
|
||||||
FROM base AS comps-base
|
|
||||||
|
|
||||||
# copy just relevant parts
|
|
||||||
COPY --from=git $HOME/GenAIComps/comps $HOME/GenAIComps/comps
|
|
||||||
COPY --from=git $HOME/GenAIComps/*.* $HOME/GenAIComps/LICENSE $HOME/GenAIComps/
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 4: unique part
|
|
||||||
FROM comps-base
|
|
||||||
|
|
||||||
COPY ./code_translation.py $HOME/code_translation.py
|
COPY ./code_translation.py $HOME/code_translation.py
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,9 @@
|
|||||||
# Copyright (C) 2024 Intel Corporation
|
# Copyright (C) 2024 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Stage 1: base setup used by other stages
|
ARG BASE_TAG=latest
|
||||||
FROM python:3.11-slim AS base
|
FROM opea/comps-base:$BASE_TAG
|
||||||
|
|
||||||
# get security updates
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV HOME=/home/user
|
|
||||||
|
|
||||||
RUN useradd -m -s /bin/bash user && \
|
|
||||||
mkdir -p $HOME && \
|
|
||||||
chown -R user $HOME
|
|
||||||
|
|
||||||
WORKDIR $HOME
|
|
||||||
|
|
||||||
# Stage 2: latest GenAIComps sources
|
|
||||||
FROM base AS git
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
|
||||||
RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git
|
|
||||||
|
|
||||||
# Stage 3: common layer shared by services using GenAIComps
|
|
||||||
FROM base AS comps-base
|
|
||||||
|
|
||||||
# copy just relevant parts
|
|
||||||
COPY --from=git $HOME/GenAIComps/comps $HOME/GenAIComps/comps
|
|
||||||
COPY --from=git $HOME/GenAIComps/*.* $HOME/GenAIComps/LICENSE $HOME/GenAIComps/
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
# Stage 4: unique part
|
|
||||||
FROM comps-base
|
|
||||||
|
|
||||||
COPY ./multimodalqna.py $HOME/multimodalqna.py
|
COPY ./multimodalqna.py $HOME/multimodalqna.py
|
||||||
|
|
||||||
ENTRYPOINT ["python", "multimodalqna.py"]
|
ENTRYPOINT ["python", "multimodalqna.py"]
|
||||||
# ENTRYPOINT ["/usr/bin/sleep", "infinity"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user