diff --git a/.github/workflows/docker-ort-runtime-ext.yml b/.github/workflows/docker-ort-runtime-ext.yml deleted file mode 100644 index 2a63ca5b68dd9..0000000000000 --- a/.github/workflows/docker-ort-runtime-ext.yml +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (C) 2023 The ORT Project Authors (see ) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# License-Filename: LICENSE - -name: Docker extended runtime image - -on: - workflow_dispatch: - workflow_run: - workflows: - - 'Docker runtime image' - types: - - completed - -env: - REGISTRY: ghcr.io - -permissions: write-all - -jobs: - android_image: - name: Android image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Android image - uses: ./.github/actions/ortdocker - with: - name: android - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.ANDROID_CMD_VERSION }}" - build-args: | - ANDROID_CMD_VERSION=${{ env.ANDROID_CMD_VERSION }} - - dart_image: - name: Dart image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Dart image - uses: ./.github/actions/ortdocker - with: - name: dart - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.DART_VERSION }}" - build-args: | - DART_VERSION=${{ env.DART_VERSION }} - - dotnet_image: - name: Dotnet image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Dotnet image - uses: ./.github/actions/ortdocker - with: - name: dotnet - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.DOTNET_VERSION }}" - build-args: | - DOTNET_VERSION=${{ env.DOTNET_VERSION }} - NUGET_INSPECTOR_VERSION=${{ env.NUGET_INSPECTOR_VERSION }} - - haskell_image: - name: Haskell image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Haskell image - uses: ./.github/actions/ortdocker - with: - name: haskell - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.HASKELL_STACK_VERSION }}" - build-args: | - HASKELL_STACK_VERSION=${{ env.HASKELL_STACK_VERSION }} - - scala_image: - name: Scala image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Scala image - uses: ./.github/actions/ortdocker - with: - name: scala - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.SBT_VERSION }}" - build-args: | - SBT_VERSION=${{ env.SBT_VERSION }} - - swift_image: - name: Swift image - runs-on: ubuntu-22.04 - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - - name: Set environment variables - run: | - cat .versions >> $GITHUB_ENV - - name: Build Swift image - uses: ./.github/actions/ortdocker - with: - name: swift - token: ${{ secrets.GITHUB_TOKEN }} - version: "${{ env.SWIFT_VERSION }}" - build-args: | - SWIFT_VERSION=${{ env.SWIFT_VERSION }} - - runtime_extended_image: - name: Build ORT extended image - needs: [ android_image, dart_image, dotnet_image, haskell_image, scala_image, swift_image ] - runs-on: ubuntu-22.04 - permissions: - contents: read - packages: write - - steps: - - name: Checkout default branch - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get ORT current version - run: | - ORT_VERSION=$(./gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") - echo "ORT_VERSION=${ORT_VERSION}" >> $GITHUB_ENV - - - name: Set up Docker build - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract components metadata (tags, labels) - id: meta-ort - uses: docker/metadata-action@v5 - with: - images: | - ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended - tags: | - type=schedule,pattern={{date 'YYYYMMDD'}} - type=schedule,pattern=snapshot - type=pep440,pattern={{version}} - type=raw,value=${{ env.ORT_VERSION }} - type=ref,event=tag - - - name: Build ORT extended runtime image - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile-extended - push: true - load: false - tags: | - ${{ steps.meta-ort.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-contexts: | - ort=docker-image://${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:${{ env.ORT_VERSION }} - android=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/android:latest - swift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/swift:latest - scala=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/scala:latest - dart=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dart:latest - dotnet=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dotnet:latest - haskell=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/haskell:latest diff --git a/.github/workflows/docker-ort-runtime.yml b/.github/workflows/docker-ort.yml similarity index 53% rename from .github/workflows/docker-ort-runtime.yml rename to .github/workflows/docker-ort.yml index dc147e089957b..890ac337bfb13 100644 --- a/.github/workflows/docker-ort-runtime.yml +++ b/.github/workflows/docker-ort.yml @@ -15,7 +15,7 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Docker runtime image +name: ORT Docker Image on: workflow_dispatch: @@ -25,7 +25,7 @@ on: paths: - '.versions' - 'Dockerfile' - - '.github/workflows/docker-ort-runtime.yml' + - '.github/workflows/docker-ort.yml' push: tags: - '*' @@ -162,9 +162,127 @@ jobs: GO_DEP_VERSION=${{ env.GO_DEP_VERSION }} GO_VERSION=${{ env.GO_VERSION }} - runtime_image: - needs: [ base_image, nodejs_image, python_image, rust_image, ruby_image, golang_image ] - name: Build ORT runtime image + android_image: + name: Android image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Android image + uses: ./.github/actions/ortdocker + with: + name: android + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.ANDROID_CMD_VERSION }}" + build-args: | + ANDROID_CMD_VERSION=${{ env.ANDROID_CMD_VERSION }} + + dart_image: + name: Dart image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Dart image + uses: ./.github/actions/ortdocker + with: + name: dart + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.DART_VERSION }}" + build-args: | + DART_VERSION=${{ env.DART_VERSION }} + + dotnet_image: + name: Dotnet image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Dotnet image + uses: ./.github/actions/ortdocker + with: + name: dotnet + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.DOTNET_VERSION }}" + build-args: | + DOTNET_VERSION=${{ env.DOTNET_VERSION }} + NUGET_INSPECTOR_VERSION=${{ env.NUGET_INSPECTOR_VERSION }} + + haskell_image: + name: Haskell image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Haskell image + uses: ./.github/actions/ortdocker + with: + name: haskell + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.HASKELL_STACK_VERSION }}" + build-args: | + HASKELL_STACK_VERSION=${{ env.HASKELL_STACK_VERSION }} + + scala_image: + name: Scala image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Scala image + uses: ./.github/actions/ortdocker + with: + name: scala + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.SBT_VERSION }}" + build-args: | + SBT_VERSION=${{ env.SBT_VERSION }} + + swift_image: + name: Swift image + needs: [ base_image ] + runs-on: ubuntu-22.04 + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + - name: Set environment variables + run: | + cat .versions >> $GITHUB_ENV + - name: Build Swift image + uses: ./.github/actions/ortdocker + with: + name: swift + token: ${{ secrets.GITHUB_TOKEN }} + version: "${{ env.SWIFT_VERSION }}" + build-args: | + SWIFT_VERSION=${{ env.SWIFT_VERSION }} + + # Minimal Runtime ORT image + # ------------------------- + minimal_image: + needs: + [ base_image, nodejs_image, python_image, rust_image, ruby_image, golang_image ] + name: Build ORT minimal image runs-on: ubuntu-22.04 permissions: contents: read @@ -196,11 +314,11 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Extract components metadata (tags, labels) - id: meta-ort + id: meta-ort-minimal uses: docker/metadata-action@v5 with: images: | - ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort + ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-minimal tags: | type=schedule,pattern={{date 'YYYYMMDD'}} type=schedule,pattern=snapshot @@ -208,18 +326,18 @@ jobs: type=raw,value=${{ env.ORT_VERSION }} type=ref,event=tag - - name: Build ORT runtime image + - name: Build ORT minimal image uses: docker/build-push-action@v5 with: context: . - target: run + target: minimal push: true load: false build-args: | NODEJS_VERSION=${{ env.NODEJS_VERSION }} ORT_VERSION=${{ env.ORT_VERSION }} tags: | - ${{ steps.meta-ort.outputs.tags }} + ${{ steps.meta-ort-minimal.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-contexts: | base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest @@ -228,3 +346,67 @@ jobs: rust=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/rust:latest ruby=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/ruby:latest golang=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/golang:latest + + # Full Runtime ORT image + # ---------------------- + ort_image: + name: Build ORT image + needs: + [ minimal_image, android_image, dart_image, dotnet_image, haskell_image, scala_image, swift_image ] + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + + steps: + - name: Checkout default branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get ORT current version + run: | + ORT_VERSION=$(./gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") + echo "ORT_VERSION=${ORT_VERSION}" >> $GITHUB_ENV + + - name: Set up Docker build + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract components metadata (tags, labels) + id: meta-ort + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort + tags: | + type=schedule,pattern={{date 'YYYYMMDD'}} + type=schedule,pattern=snapshot + type=pep440,pattern={{version}} + type=raw,value=${{ env.ORT_VERSION }} + type=ref,event=tag + + - name: Build ORT image + uses: docker/build-push-action@v5 + with: + context: . + target: run + push: true + load: false + tags: | + ${{ steps.meta-ort.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-contexts: | + minimal=docker-image://${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-minimal:${{ env.ORT_VERSION }} + android=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/android:latest + swift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/swift:latest + scala=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/scala:latest + dart=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dart:latest + dotnet=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dotnet:latest + haskell=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/haskell:latest