From e5ad3666aca7ef05e312b8bbd212b88f892f46d4 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Fri, 8 Sep 2023 09:53:14 +0200 Subject: [PATCH] feat(docker): Provide extended image with all components Signed-off-by: Helio Chissini de Castro --- .github/workflows/docker-ort-runtime-ext.yml | 95 ++++++++++++++++++++ Dockerfile-extended | 15 ++-- 2 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/docker-ort-runtime-ext.yml diff --git a/.github/workflows/docker-ort-runtime-ext.yml b/.github/workflows/docker-ort-runtime-ext.yml new file mode 100644 index 000000000000..5a2d98ccf3e0 --- /dev/null +++ b/.github/workflows/docker-ort-runtime-ext.yml @@ -0,0 +1,95 @@ + # 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: Extended Image + +on: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - main + workflow_run: + workflows: + - 'Android Image' + - 'Dart Image' + - 'Dotnet Image' + - 'Haskell Image' + - 'Runtime Image' + - 'Scala Image' + - 'Swift Image' + + types: + - completed + +env: + REGISTRY: ghcr.io + +permissions: write-all + +jobs: + build: + name: Build ORT Extended Image + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + + steps: + - name: Checkout default branch + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract components metadata (tags, labels) for Ort runtime image + id: meta-ort + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended + tags: | + type=raw,sha,enable=true,format=short + + - name: Build ORT runtime container + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile-extended + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} + load: false + tags: | + ${{ steps.meta-ort.outputs.tags }} + ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended:latest + labels: ${{ steps.meta.outputs.labels }} + build-contexts: | + android=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/android:latest + swift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/swift:latest + sbt=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/sbt: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 + dotnet=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dotnet:latest diff --git a/Dockerfile-extended b/Dockerfile-extended index 81a007d6cd63..3dce2517060c 100644 --- a/Dockerfile-extended +++ b/Dockerfile-extended @@ -22,15 +22,15 @@ ENV ANDROID_HOME=/opt/android-sdk ENV ANDROID_USER_HOME=$HOME/.android ENV PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/cmdline-tools/bin ENV PATH=$PATH:$ANDROID_HOME/platform-tools -COPY --from=ghcr.io/oss-review-toolkit/android --chown=$USER:$USER $ANDROID_HOME $ANDROID_HOME -RUN chmod -R o+rw $ANDROID_HOME +COPY --from=android --chown=$USER:$USER $ANDROID_HOME $ANDROID_HOME +RUN sudo chmod -R o+rw $ANDROID_HOME RUN syft $ANDROID_HOME -o spdx-json --file /usr/share/doc/ort/ort-android.spdx.json # Swift ENV SWIFT_HOME=/opt/swift ENV PATH=$PATH:$SWIFT_HOME/bin -COPY --from=ghcr.io/oss-review-toolkit/swift --chown=$USER:$USER $SWIFT_HOME $SWIFT_HOME +COPY --from=swift --chown=$USER:$USER $SWIFT_HOME $SWIFT_HOME RUN syft $SWIFT_HOME -o spdx-json --file /usr/share/doc/ort/ort-swift.spdx.json @@ -38,14 +38,14 @@ RUN syft $SWIFT_HOME -o spdx-json --file /usr/share/doc/ort/ort-swift.spdx.json # Scala ENV SBT_HOME=/opt/sbt ENV PATH=$PATH:$SBT_HOME/bin -COPY --from=ghcr.io/oss-review-toolkit/sbt --chown=$USER:$USER $SBT_HOME $SBT_HOME +COPY --from=sbt --chown=$USER:$USER $SBT_HOME $SBT_HOME RUN syft $SBT_HOME -o spdx-json --file /usr/share/doc/ort/ort-sbt.spdx.json # Dart ENV DART_SDK=/opt/dart-sdk ENV PATH=$PATH:$DART_SDK/bin -COPY --from=ghcr.io/oss-review-toolkit/dart --chown=$USER:$USER $DART_SDK $DART_SDK +COPY --from=dart --chown=$USER:$USER $DART_SDK $DART_SDK RUN syft $DART_SDK -o spdx-json --file /usr/share/doc/ort/ort-golang.dart.json @@ -54,7 +54,7 @@ ENV DOTNET_HOME=/opt/dotnet ENV NUGET_INSPECTOR_HOME=$DOTNET_HOME ENV PATH=$PATH:$DOTNET_HOME:$DOTNET_HOME/tools:$DOTNET_HOME/bin -COPY --from=ghcr.io/oss-review-toolkit/dotnet --chown=$USER:$USER $DOTNET_HOME $DOTNET_HOME +COPY --from=dotnet --chown=$USER:$USER $DOTNET_HOME $DOTNET_HOME RUN syft $DOTNET_HOME -o spdx-json --file /usr/share/doc/ort/ort-dotnet.spdx.json @@ -77,10 +77,9 @@ ENV PATH=$PATH:/opt/php/bin RUN syft /opt/php -o spdx-json --file /usr/share/doc/ort/ort-php.spdx.json # Haskell -ARG HASKELL_STACK_VERSION=2.7.5 ENV HASKELL_HOME=/opt/haskell ENV PATH=$PATH:$HASKELL_HOME/bin -COPY --from=ghcr.io/oss-review-toolkit/haskell /opt/haskell /opt/haskell +COPY --from=haskell /opt/haskell /opt/haskell RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json