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": [
{
"pattern": "^https://www.reddit.com/"
},
{
"pattern": "^https://developer.nvidia.com/"
},
......
......@@ -14,6 +14,18 @@ on:
- main
tags:
- "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:
publish_docker_image:
......@@ -21,9 +33,12 @@ jobs:
environment: 'prod'
env:
TAG_PREFIX: "openmmlab/lmdeploy"
TAG: "openmmlab/lmdeploy:latest"
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{github.event.inputs.repo_ref}}
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
......@@ -39,24 +54,28 @@ jobs:
- name: Get docker info
run: |
docker info
# remove http extraheader
git config --local --unset "http.https://github.com/.extraheader"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
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: |
export TAG=$TAG_PREFIX:latest
export TAG=$TAG_PREFIX:${{github.event.inputs.image_tag}}
echo $TAG
docker build docker/ -t ${TAG} --no-cache
docker push $TAG
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
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
export RELEASE_TAG=${TAG_PREFIX}:v${LMDEPLOY_VERSION}
export RELEASE_TAG=${TAG_PREFIX}:${{github.ref_name}}
echo $RELEASE_TAG
docker tag $TAG $RELEASE_TAG
docker push $RELEASE_TAG
......@@ -9,10 +9,12 @@ RUN python3 -m pip install --no-cache-dir cmake packaging
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 &&\
cd lmdeploy &&\
WORKDIR /opt/lmdeploy
RUN cd /opt/lmdeploy &&\
python3 -m pip install --no-cache-dir -r requirements.txt &&\
mkdir -p build && cd build &&\
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