Unverified Commit 872701e3 authored by RunningLeon's avatar RunningLeon Committed by GitHub
Browse files

Support building docker image manually in CI (#825)

* update dockerfile and ci

* remove unused env

* ignore link check of reddit website urls
parent 5c9aa51a
{ {
"ignorePatterns": [ "ignorePatterns": [
{
"pattern": "^https://www.reddit.com/"
},
{ {
"pattern": "^https://developer.nvidia.com/" "pattern": "^https://developer.nvidia.com/"
}, },
......
...@@ -14,6 +14,18 @@ on: ...@@ -14,6 +14,18 @@ on:
- main - main
tags: tags:
- "v*.*.*" - "v*.*.*"
workflow_dispatch:
inputs:
repo_ref:
required: true
description: 'Set branch or tag or commit id. Default is ""'
type: string
default: ''
image_tag:
required: true
description: 'Set docker image tag. Default is "latest"'
type: string
default: latest
jobs: jobs:
publish_docker_image: publish_docker_image:
...@@ -21,9 +33,12 @@ jobs: ...@@ -21,9 +33,12 @@ jobs:
environment: 'prod' environment: 'prod'
env: env:
TAG_PREFIX: "openmmlab/lmdeploy" TAG_PREFIX: "openmmlab/lmdeploy"
TAG: "openmmlab/lmdeploy:latest"
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
ref: ${{github.event.inputs.repo_ref}}
- name: Free disk space - name: Free disk space
uses: jlumbroso/free-disk-space@main uses: jlumbroso/free-disk-space@main
with: with:
...@@ -39,24 +54,28 @@ jobs: ...@@ -39,24 +54,28 @@ jobs:
- name: Get docker info - name: Get docker info
run: | run: |
docker info docker info
# remove http extraheader
git config --local --unset "http.https://github.com/.extraheader"
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push the latest Docker image - name: Update docker TAG from workflow input
if: github.event_name == 'workflow_dispatch'
run: | run: |
export TAG=$TAG_PREFIX:latest export TAG=$TAG_PREFIX:${{github.event.inputs.image_tag}}
echo $TAG echo $TAG
docker build docker/ -t ${TAG} --no-cache
docker push $TAG
echo "TAG=${TAG}" >> $GITHUB_ENV echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Build and push Docker image
run: |
echo $TAG
docker build . -f docker/Dockerfile -t ${TAG} --no-cache
docker push $TAG
- name: Push docker image with released tag - name: Push docker image with released tag
if: startsWith(github.ref, 'refs/tags/') == true if: startsWith(github.ref, 'refs/tags/') == true
run: | run: |
export LMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('lmdeploy');from version import __version__;print(__version__)") export RELEASE_TAG=${TAG_PREFIX}:${{github.ref_name}}
echo $LMDEPLOY_VERSION
export RELEASE_TAG=${TAG_PREFIX}:v${LMDEPLOY_VERSION}
echo $RELEASE_TAG echo $RELEASE_TAG
docker tag $TAG $RELEASE_TAG docker tag $TAG $RELEASE_TAG
docker push $RELEASE_TAG docker push $RELEASE_TAG
...@@ -9,10 +9,12 @@ RUN python3 -m pip install --no-cache-dir cmake packaging ...@@ -9,10 +9,12 @@ RUN python3 -m pip install --no-cache-dir cmake packaging
ENV NCCL_LAUNCH_MODE=GROUP ENV NCCL_LAUNCH_MODE=GROUP
ARG VERSION=main # Should be in the lmdeploy root directory when building docker image
COPY . /opt/lmdeploy
RUN git clone --depth=1 --branch=${VERSION} https://github.com/InternLM/lmdeploy.git &&\ WORKDIR /opt/lmdeploy
cd lmdeploy &&\
RUN cd /opt/lmdeploy &&\
python3 -m pip install --no-cache-dir -r requirements.txt &&\ python3 -m pip install --no-cache-dir -r requirements.txt &&\
mkdir -p build && cd build &&\ mkdir -p build && cd build &&\
cmake .. \ cmake .. \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment