From 0632735591e5b7c34802a29e453e4ad6b7eb248f Mon Sep 17 00:00:00 2001 From: RunningLeon Date: Tue, 22 Aug 2023 14:17:32 +0800 Subject: [PATCH] Update workflow for building docker image (#282) * update * debug * Revert "debug" This reverts commit 1c1f1d75591e44bf315c720f4954d1ea30b92989. * update --- .github/workflows/docker.yml | 26 +++++++++++--------------- docker/Dockerfile | 8 ++++---- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 67eda3c1d..8d778817a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,23 +28,19 @@ jobs: export commit_id=$(git log --format="%H" -n 1) echo "commit id = $commit_id" echo "COMMIT_ID=$commit_id" >> $GITHUB_ENV - - name: Get lmdeploy version - if: startsWith(github.ref, 'refs/tags/') == false + - name: Build and push the latest Docker image run: | - echo "TAG=$TAG_PREFIX:latest" >> $GITHUB_ENV - - name: Get lmdeploy tag + export TAG=$TAG_PREFIX:latest + echo $TAG + docker build docker/ -t ${TAG} --build-arg COMMIT_ID=${COMMIT_ID} + docker push $TAG + echo "TAG=${TAG}" >> $GITHUB_ENV + - name: Push docker image with released tag if: startsWith(github.ref, 'refs/tags/') == true run: | export LMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('lmdeploy');from version import __version__;print(__version__)") echo $LMDEPLOY_VERSION - echo "TAG=${TAG_PREFIX}:v${LMDEPLOY_VERSION}" >> $GITHUB_ENV - - name: Build Docker image - continue-on-error: true - run: | - echo $TAG - docker build docker/ -t ${TAG} --build-arg COMMIT_ID=${COMMIT_ID} - - name: Push Docker image - continue-on-error: true - run: | - echo $TAG - docker push $TAG + export RELEASE_TAG=${TAG_PREFIX}:v${LMDEPLOY_VERSION} + echo $RELEASE_TAG + docker tag $TAG $RELEASE_TAG + docker push $RELEASE_TAG diff --git a/docker/Dockerfile b/docker/Dockerfile index 928abb516..faf7fdf55 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,11 +1,11 @@ FROM nvcr.io/nvidia/tritonserver:22.12-py3 -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN rm /etc/apt/sources.list.d/cuda*.list && apt-get update && apt-get install -y --no-install-recommends \ rapidjson-dev libgoogle-glog-dev gdb \ && rm -rf /var/lib/apt/lists/* -RUN python3 -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 -RUN python3 -m pip install cmake +RUN python3 -m pip install --no-cache-dir torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +RUN python3 -m pip install --no-cache-dir cmake ENV NCCL_LAUNCH_MODE=GROUP @@ -14,7 +14,7 @@ ARG COMMIT_ID=main RUN git clone --depth=1 https://github.com/InternLM/lmdeploy.git &&\ cd lmdeploy &&\ git checkout ${COMMIT_ID} &&\ - python3 -m pip install -r requirements.txt &&\ + python3 -m pip install --no-cache-dir -r requirements.txt &&\ mkdir -p build && cd build &&\ cmake .. \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \