| name: publish-docker |
|
|
| on: |
| push: |
| paths-ignore: |
| - "!.github/workflows/docker.yml" |
| - ".github/**" |
| - "docs/**" |
| - "resources/**" |
| - "benchmark/**" |
| - "tests/**" |
| - "**/*.md" |
| - "autotest/**" |
| - "builder/**" |
| - "k8s/**" |
|
|
| branches: |
| - main |
| tags: |
| - "v*.*.*" |
| workflow_dispatch: |
| inputs: |
| repo_ref: |
| required: false |
| description: 'Set branch or tag or commit id. Default is ""' |
| type: string |
| default: 'main' |
| image_tag: |
| required: true |
| description: 'Set docker image tag. Default is "latest"' |
| type: string |
| default: latest |
|
|
| jobs: |
| publish_docker_image: |
| runs-on: ubuntu-latest |
| environment: 'prod' |
| strategy: |
| fail-fast: false |
| matrix: |
| cuda_version: ['cu12.8', 'cu12'] |
| env: |
| CUDA_VERSION: ${{ matrix.cuda_version }} |
| TAG_PREFIX: "openmmlab/lmdeploy" |
| TAG: "openmmlab/lmdeploy:latest-${{matrix.cuda_version}}" |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| with: |
| ref: ${{github.event.inputs.repo_ref}} |
| - name: Free disk space |
| uses: jlumbroso/free-disk-space@main |
| with: |
| |
| tool-cache: false |
| docker-images: false |
| |
| android: true |
| dotnet: true |
| haskell: true |
| large-packages: true |
| swap-storage: false |
| - 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: Update docker TAG from workflow input |
| if: github.event_name == 'workflow_dispatch' |
| run: | |
| export TAG=$TAG_PREFIX:${{github.event.inputs.image_tag}}-${CUDA_VERSION} |
| echo $TAG |
| echo "TAG=${TAG}" >> $GITHUB_ENV |
| - name: Build and push Docker image |
| run: | |
| echo $TAG |
| docker build . -f docker/Dockerfile -t ${TAG} --build-arg CUDA_VERSION=${CUDA_VERSION} |
| docker push $TAG |
| - name: Push Docker image as latest |
| if: endsWith(env.TAG, 'latest-cu12') == true |
| run: | |
| export latest_TAG=${TAG_PREFIX}:latest |
| echo $latest_TAG |
| docker tag $TAG $latest_TAG |
| docker push $latest_TAG |
| - name: Push docker image with released tag |
| if: startsWith(github.ref, 'refs/tags/') == true |
| run: | |
| export RELEASE_TAG=${TAG_PREFIX}:${{github.ref_name}}-${CUDA_VERSION} |
| echo $RELEASE_TAG |
| docker tag $TAG $RELEASE_TAG |
| docker push $RELEASE_TAG |
| |
| publish_ascend_docker_image: |
| runs-on: ubuntu-latest |
| environment: 'prod' |
| env: |
| TAG_PREFIX: "openmmlab/lmdeploy" |
| TAG: "openmmlab/lmdeploy:ascend" |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| with: |
| ref: ${{github.event.inputs.repo_ref}} |
| - name: Free disk space |
| uses: jlumbroso/free-disk-space@main |
| with: |
| |
| tool-cache: false |
| docker-images: false |
| |
| android: true |
| dotnet: true |
| haskell: true |
| large-packages: true |
| swap-storage: false |
| - name: Set up QEMU |
| uses: docker/setup-qemu-action@v3 |
| - name: Set up Docker Buildx |
| uses: docker/setup-buildx-action@v3 |
| - 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: Update docker TAG from workflow input |
| if: github.event_name == 'workflow_dispatch' |
| run: | |
| export TAG=$TAG_PREFIX:${{github.event.inputs.image_tag}}-ascend |
| echo $TAG |
| echo "TAG=${TAG}" >> $GITHUB_ENV |
| - name: Build and push Docker image |
| run: | |
| echo $TAG |
| docker build . -t ${TAG} -f docker/Dockerfile_ascend_a3 --platform linux/arm64 |
| docker push $TAG |
| |