From b592621393c69bd8297402aa7debacb5e06d7ba2 Mon Sep 17 00:00:00 2001 From: jakki Date: Tue, 26 Nov 2024 13:56:03 +0200 Subject: [PATCH] Reorder and fix installation process --- docker/Dockerfile | 18 +++++++++++++++--- docker/Dockerfile.rocm | 8 ++------ docker/build_image.sh | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a50c84e2d0..bc738ad90d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -94,10 +94,10 @@ RUN \ elif echo "${BASE_IMAGE}" | grep -q "rocm/"; then \ # Install ROCm version specific binary when ROCm version is specified as a build arg if [ "$USE_ROCM_VERSION" ]; then \ - python ./ts_scripts/install_dependencies.py --rocm $USE_ROCM_VERSION\ + python ./ts_scripts/install_dependencies.py --rocm $USE_ROCM_VERSION;\ # Install the binary with the latest CPU image on a ROCm base image else \ - python ./ts_scripts/install_dependencies.py;\ + python ./ts_scripts/install_dependencies.py; \ fi; \ # Install the CPU binary else \ @@ -192,7 +192,6 @@ RUN --mount=type=cache,target=/var/cache/apt \ && rm -rf /var/lib/apt/lists/* \ && cd /tmp - COPY --from=compile-image /home/venv /home/venv ENV PATH="/home/venv/bin:$PATH" @@ -211,6 +210,7 @@ FROM ${BASE_IMAGE} as dev-image ARG PYTHON_VERSION ARG BRANCH_NAME ARG BUILD_FROM_SRC +ARG USE_ROCM_VERSION ARG LOCAL_CHANGES ARG BUILD_WITH_IPEX ARG IPEX_VERSION=1.11.0 @@ -236,9 +236,15 @@ RUN --mount=type=cache,target=/var/cache/apt \ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009905 openjdk-17-jdk \ build-essential \ + wget \ curl \ vim \ numactl \ + nodejs \ + npm \ + zip \ + unzip \ + && npm install -g newman@5.3.2 newman-reporter-htmlextra markdown-link-check \ && if [ "$BUILD_WITH_IPEX" = "true" ]; then apt-get update && apt-get install -y libjemalloc-dev libgoogle-perftools-dev libomp-dev && ln -s /usr/lib/x86_64-linux-gnu/libjemalloc.so /usr/lib/libjemalloc.so && ln -s /usr/lib/x86_64-linux-gnu/libtcmalloc.so /usr/lib/libtcmalloc.so && ln -s /usr/lib/x86_64-linux-gnu/libiomp5.so /usr/lib/libiomp5.so; fi \ && rm -rf /var/lib/apt/lists/* @@ -253,6 +259,12 @@ RUN \ COPY --from=compile-image /home/venv /home/venv ENV PATH="/home/venv/bin:$PATH" WORKDIR "serve" + +RUN \ + if [ "$USE_ROCM_VERSION" ]; then \ + python -m pip install /opt/rocm/share/amd_smi; \ + fi + RUN python -m pip install -U pip setuptools \ && python -m pip install --no-cache-dir -r requirements/developer.txt \ && python ts_scripts/install_from_src.py \ diff --git a/docker/Dockerfile.rocm b/docker/Dockerfile.rocm index f9ff5dce79..ccefd7b944 100644 --- a/docker/Dockerfile.rocm +++ b/docker/Dockerfile.rocm @@ -277,16 +277,12 @@ WORKDIR "/serve" RUN \ if [ "$USE_ROCM_VERSION" ]; then \ - python ts_scripts/install_dependencies.py --environment=dev --rocm $USE_ROCM_VERSION \ - && cd /opt/rocm/share/amd_smi \ - && python -m pip install . ; \ - # Install the binary with the latest CPU image on a ROCm base image - else \ - python ts_scripts/install_dependencies.py --environment=dev;\ + python -m pip install /opt/rocm/share/amd_smi ; \ fi; RUN python -m pip install -U pip setuptools \ && python -m pip install --no-cache-dir -r requirements/developer.txt \ + && python ts_scripts/install_dependencies.py --environment dev \ && python ts_scripts/install_from_src.py --environment=dev \ && useradd -m model-server \ && mkdir -p /home/model-server/tmp \ diff --git a/docker/build_image.sh b/docker/build_image.sh index f998150a66..a6ddac2fee 100755 --- a/docker/build_image.sh +++ b/docker/build_image.sh @@ -269,7 +269,7 @@ if [ "${BUILD_TYPE}" == "production" ]; then fi elif [ "${BUILD_TYPE}" == "ci" ]; then - DOCKER_BUILDKIT=1 docker build --file Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" --build-arg USE_CUDA_VERSION="${CUDA_VERSION}" --build-arg PYTHON_VERSION="${PYTHON_VERSION}"\ + DOCKER_BUILDKIT=1 docker build --file Dockerfile --build-arg BASE_IMAGE="${BASE_IMAGE}" --build-arg USE_CUDA_VERSION="${CUDA_VERSION}" --build-arg USE_ROCM_VERSION="${ROCM_VERSION}" --build-arg PYTHON_VERSION="${PYTHON_VERSION}"\ --build-arg BUILD_NIGHTLY="${BUILD_NIGHTLY}" --build-arg BRANCH_NAME="${BRANCH_NAME}" --build-arg REPO_URL="${REPO_URL}" --build-arg BUILD_FROM_SRC="${BUILD_FROM_SRC}"\ --build-arg LOCAL_CHANGES="${LOCAL_CHANGES}" -t "${DOCKER_TAG}" --target ci-image ../ else