diff --git a/.github/workflows/docker-ort-android.yml b/.github/workflows/docker-ort-android.yml index e16b7d79b45a4..02d6914d75fa6 100644 --- a/.github/workflows/docker-ort-android.yml +++ b/.github/workflows/docker-ort-android.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Android Container +name: Android Image on: workflow_dispatch: pull_request: - branches: - - main - push: paths: - '.ortversions/android.versions' - '.github/workflows/docker-ort-base.yml' + push: + branches: + - main workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: android - push: true + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | ANDROID_CMD_VERSION=${{ env.ANDROID_CMD_VERSION }} diff --git a/.github/workflows/docker-ort-base.yml b/.github/workflows/docker-ort-base.yml index dbd88acf322f6..5f0589ce94d18 100644 --- a/.github/workflows/docker-ort-base.yml +++ b/.github/workflows/docker-ort-base.yml @@ -15,17 +15,17 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Base Container +name: Base Image on: workflow_dispatch: pull_request: - branches: - - main - push: paths: - - 'Dockerfile' - '.ortversions/base.versions' + - 'Dockerfile' + push: + branches: + - main env: REGISTRY: ghcr.io @@ -70,7 +70,7 @@ jobs: with: context: . target: ort-base-image - push: true + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | JAVA_VERSION=${{ env.JAVA_VERSION }} diff --git a/.github/workflows/docker-ort-binaries.yml b/.github/workflows/docker-ort-binaries.yml deleted file mode 100644 index 2d7494a8f9cf7..0000000000000 --- a/.github/workflows/docker-ort-binaries.yml +++ /dev/null @@ -1,87 +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: Ort Binaries Container - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - workflow_run: - workflows: ["Ort Docker Base Image"] - types: - - completed - -env: - REGISTRY: ghcr.io - -permissions: write-all - -jobs: - build: - name: Build ORT Binary Image - runs-on: ubuntu-22.04 - permissions: - contents: read - packages: write - - steps: - - name: Checkout main repository - uses: actions/checkout@v3 - with: - ref: main - - - 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 base image - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ${{ env.REGISTRY }}/${{ github.repository }}/ortbin - tags: | - type=raw,sha,enable=true,format=short - - - name: Build ORT ort container - uses: docker/build-push-action@v4 - with: - context: . - target: ort - push: true - load: false - build-args: | - ORT_VERSION=${{ env.ORT_VERSION }} - tags: | - ${{ steps.meta.outputs.tags }} - ${{ env.REGISTRY }}/${{ github.repository }}/ortbin:latest - labels: ${{ steps.meta.outputs.labels }} - build-contexts: | - ort-base-image=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest - cache-from: type=gha,scope=ortort - cache-to: type=gha,scope=ortort,mode=max diff --git a/.github/workflows/docker-ort-dart.yml b/.github/workflows/docker-ort-dart.yml index d4e3967828e99..b84ee98981924 100644 --- a/.github/workflows/docker-ort-dart.yml +++ b/.github/workflows/docker-ort-dart.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Dart Container +name: Dart Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/dart.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: dart - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | DART_VERSION=${{ env.DART_VERSION }} diff --git a/.github/workflows/docker-ort-dotnet.yml b/.github/workflows/docker-ort-dotnet.yml index 98e81c3a814b1..38a574922574a 100644 --- a/.github/workflows/docker-ort-dotnet.yml +++ b/.github/workflows/docker-ort-dotnet.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Dotnet Container +name: Dotnet Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/dotnet.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] env: REGISTRY: ghcr.io @@ -74,7 +74,7 @@ jobs: with: context: . target: dotnet - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | DOTNET_VERSION=${{ env.DOTNET_VERSION }} diff --git a/.github/workflows/docker-ort-golang.yml b/.github/workflows/docker-ort-golang.yml index a2220af15ec0e..bedfd252ae83c 100644 --- a/.github/workflows/docker-ort-golang.yml +++ b/.github/workflows/docker-ort-golang.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Golang Container +name: Golang Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/golang.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: golang - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | GO_DEP_VERSION=${{ env.GO_DEP_VERSION }} diff --git a/.github/workflows/docker-ort-haskell.yml b/.github/workflows/docker-ort-haskell.yml index db9077e99d93b..01a7c9c3365e6 100644 --- a/.github/workflows/docker-ort-haskell.yml +++ b/.github/workflows/docker-ort-haskell.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Haskell Container +name: Haskell Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/haskell.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: haskell - push: true + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | HASKELL_STACK_VERSION=${{ env.HASKELL_STACK_VERSION }} diff --git a/.github/workflows/docker-ort-nodejs.yml b/.github/workflows/docker-ort-nodejs.yml index bfe500ba0234c..437da65c1e6b9 100644 --- a/.github/workflows/docker-ort-nodejs.yml +++ b/.github/workflows/docker-ort-nodejs.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort NodeJS Container +name: NodeJS Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/nodejs.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -76,7 +76,7 @@ jobs: with: context: . target: nodejs - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | NODEJS_VERSION=${{ env.NODEJS_VERSION }} diff --git a/.github/workflows/docker-ort-python.yml b/.github/workflows/docker-ort-python.yml index f82be976e3837..783e3fc4d3bec 100644 --- a/.github/workflows/docker-ort-python.yml +++ b/.github/workflows/docker-ort-python.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Python Container +name: Python Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/python.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -76,7 +76,7 @@ jobs: with: context: . target: python - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | CONAN_VERSION=${{ env.CONAN_VERSION }} diff --git a/.github/workflows/docker-ort-ruby.yml b/.github/workflows/docker-ort-ruby.yml index 5848bf1875e98..1bb9afc8d87be 100644 --- a/.github/workflows/docker-ort-ruby.yml +++ b/.github/workflows/docker-ort-ruby.yml @@ -15,19 +15,20 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Ruby Container +name: Ruby Image on: - workflow_run: - workflows: ["Ort Docker Base Image"] workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/ruby.versions' - '.github/workflows/docker-ort-base.yml' + workflow_run: + workflows: ["Base Image"] + env: REGISTRY: ghcr.io @@ -76,7 +77,7 @@ jobs: with: context: . target: ruby - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | RUBY_VERSION=${{ env.RUBY_VERSION }} diff --git a/.github/workflows/docker-ort-runtime.yml b/.github/workflows/docker-ort-runtime.yml index 38dbbedd8b593..1eb2eb050067c 100644 --- a/.github/workflows/docker-ort-runtime.yml +++ b/.github/workflows/docker-ort-runtime.yml @@ -15,7 +15,7 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Runtime Container +name: Runtime Image on: workflow_dispatch: @@ -27,12 +27,11 @@ on: - main workflow_run: workflows: - - 'Ort Binaries Container' - - 'Ort Python Container' - - 'Ort NodeJS Container' - - 'Ort Ruby Container' - - 'Ort Rust Container' - - 'Ort Golang Container' + - 'Python Image' + - 'NodeJS Image' + - 'Ruby Image' + - 'Rust Image' + - 'Golang Image' types: - completed @@ -81,7 +80,7 @@ jobs: with: context: . target: run - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | NODEJS_VERSION=${{ env.NODEJS_VERSION }} @@ -90,7 +89,6 @@ jobs: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:latest labels: ${{ steps.meta.outputs.labels }} build-contexts: | - ort=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/ortbin:latest nodejs=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/nodejs:latest python=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/python:latest rust=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/rust:latest diff --git a/.github/workflows/docker-ort-rust.yml b/.github/workflows/docker-ort-rust.yml index 8c94225689f7b..295a6351c196e 100644 --- a/.github/workflows/docker-ort-rust.yml +++ b/.github/workflows/docker-ort-rust.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Rust Container +name: Rust Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/rust.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] env: REGISTRY: ghcr.io @@ -75,7 +75,7 @@ jobs: with: context: . target: rust - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | RUST_VERSION=${{ env.RUST_VERSION }} diff --git a/.github/workflows/docker-ort-sbt.yml b/.github/workflows/docker-ort-sbt.yml index d8f32ce425b49..b4395ce1ee800 100644 --- a/.github/workflows/docker-ort-sbt.yml +++ b/.github/workflows/docker-ort-sbt.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Sbt Container +name: Scala Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/sbt.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: sbt - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | SBT_VERSION=${{ env.SBT_VERSION }} diff --git a/.github/workflows/docker-ort-swift.yml b/.github/workflows/docker-ort-swift.yml index 90d4a9fd26255..24e4ecec9347d 100644 --- a/.github/workflows/docker-ort-swift.yml +++ b/.github/workflows/docker-ort-swift.yml @@ -15,19 +15,19 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -name: Ort Docker Swift Container +name: Swift Image on: workflow_dispatch: - pull_request: + push: branches: - main - push: + pull_request: paths: - '.ortversions/swift.versions' - '.github/workflows/docker-ort-base.yml' workflow_run: - workflows: ["Ort Docker Base Image"] + workflows: ["Base Image"] types: - completed @@ -77,7 +77,7 @@ jobs: with: context: . target: swift - push: ${{ github.event_name == 'push' }} + push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} load: false build-args: | SWIFT_VERSION=${{ env.SWIFT_VERSION }} diff --git a/.ortversions/python.versions b/.ortversions/python.versions index 8225ff2022fa1..35b83ed1ce6b0 100644 --- a/.ortversions/python.versions +++ b/.ortversions/python.versions @@ -5,4 +5,4 @@ PYTHON_INSPECTOR_VERSION=0.9.8 PYTHON_PIPENV_VERSION=2022.9.24 PYTHON_POETRY_VERSION=1.6.1 PYTHON_VERSION=3.10.13 -SCANCODE_VERSION=31.2.4 +SCANCODE_VERSION=32.0.6 diff --git a/Dockerfile b/Dockerfile index 3793af8203a25..9234dc5b3a4b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -462,20 +462,20 @@ ENV RUST_HOME=/opt/rust ENV CARGO_HOME=$RUST_HOME/cargo ENV RUSTUP_HOME=$RUST_HOME/rustup ENV PATH=$PATH:$CARGO_HOME/bin:$RUSTUP_HOME/bin -COPY --from=ghcr.io/oss-review-toolkit/rust --chown=$USER:$USER $RUST_HOME $RUST_HOME +COPY --from=rust --chown=$USER:$USER $RUST_HOME $RUST_HOME RUN chmod o+rwx $CARGO_HOME RUN syft $RUST_HOME -o spdx-json --file /usr/share/doc/ort/ort-rust.spdx.json # Golang ENV PATH=$PATH:/opt/go/bin -COPY --from=ghcr.io/oss-review-toolkit/golang --chown=$USER:$USER /opt/go /opt/go +COPY --from=golang --chown=$USER:$USER /opt/go /opt/go RUN syft /opt/go -o spdx-json --file /usr/share/doc/ort/ort-golang.spdx.json # Ruby ENV RBENV_ROOT=/opt/rbenv/ ENV GEM_HOME=/var/tmp/gem ENV PATH=$PATH:$RBENV_ROOT/bin:$RBENV_ROOT/shims:$RBENV_ROOT/plugins/ruby-install/bin -COPY --from=ghcr.io/oss-review-toolkit/ruby --chown=$USER:$USER $RBENV_ROOT $RBENV_ROOT +COPY --from=ruby --chown=$USER:$USER $RBENV_ROOT $RBENV_ROOT RUN syft $RBENV_ROOT -o spdx-json --file /usr/share/doc/ort/ort-ruby.spdx.json # ORT diff --git a/Dockerfile-extended b/Dockerfile-extended new file mode 100644 index 0000000000000..81a007d6cd639 --- /dev/null +++ b/Dockerfile-extended @@ -0,0 +1,86 @@ +FROM ghcr.io/oss-review-toolkit/ort + +# 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 + +# Repo and Android +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 + +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 + +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 + +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 + +RUN syft $DART_SDK -o spdx-json --file /usr/share/doc/ort/ort-golang.dart.json + +# Dotnet +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 + +RUN syft $DOTNET_HOME -o spdx-json --file /usr/share/doc/ort/ort-dotnet.spdx.json + +# PHP +ARG PHP_VERSION=8.1 +ARG COMPOSER_VERSION=2.2 + +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update && \ + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \ + php${PHP_VERSION} \ + && sudo rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /opt/php/bin \ + && curl -ksS https://getcomposer.org/installer | php -- --install-dir=/opt/php/bin --filename=composer --$COMPOSER_VERSION + +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 + +RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json diff --git a/scripts/custom_docker.sh b/scripts/custom_docker.sh index f0d1ca575218f..0e08cefe4d50a 100755 --- a/scripts/custom_docker.sh +++ b/scripts/custom_docker.sh @@ -33,7 +33,7 @@ dockerfile_template="FROM ghcr.io/oss-review-toolkit/ort\n" output_file="Dockerfile.custom" function usage() { - echo "Usage: $0 -c [ ...] -output " + echo "Usage: $0 -c [ ...] -o " echo "Options:" echo " -c [ ...]: List of language components to include in the Dockerfile: ${valid_components[*]}" echo " -output : Output file for the generated Dockerfile, Defaults to Dockerfile.custom." @@ -48,7 +48,7 @@ while [[ $# -gt 0 ]]; do components=("$@") break ;; - -output) + -o) shift output_file=$1 ;; diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh index cae24125d0dc3..ee58e3392a234 100755 --- a/scripts/docker_build.sh +++ b/scripts/docker_build.sh @@ -21,6 +21,7 @@ set -e -o pipefail GIT_ROOT=$(git rev-parse --show-toplevel) GIT_REVISION=$($GIT_ROOT/gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") +DOCKER_IMAGE_ROOT="${DOCKER_IMAGE_ROOT:-ghcr.io/oss-review-toolkit}" echo "Setting ORT_VERSION to $GIT_REVISION." @@ -159,9 +160,9 @@ image_build dotnet dotnet "$DOTNET_VERSION" \ --build-arg NUGET_INSPECTOR_VERSION="$NUGET_INSPECTOR_VERSION" \ "$@" -# Dotnet +# Haskell # shellcheck disable=SC1091 . .ortversions/haskell.versions -image_build dotnet dotnet "$HASKELL_STACK_VERSION" \ +image_build haskell haskell "$HASKELL_STACK_VERSION" \ --build-arg HASKELL_STACK_VERSION="$HASKELL_STACK_VERSION" \ "$@" diff --git a/scripts/docker_build_all.sh b/scripts/docker_build_all.sh deleted file mode 100755 index e99e86eee37f3..0000000000000 --- a/scripts/docker_build_all.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2020 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 - -set -e -o pipefail - -GIT_ROOT=$(git rev-parse --show-toplevel) -GIT_REVISION=$(git describe --abbrev=10 --always --tags --dirty --match=[0-9]*) -DOCKER_IMAGE_ROOT="${DOCKER_IMAGE_ROOT:-ort}" - -echo "Setting ORT_VERSION to $GIT_REVISION." - -# --------------------------- -# image_build function -# Usage ( position paramenters): -# image_build - -image_build() { - local target - local name - local version - target="$1" - shift - name="$1" - shift - version="$1" - shift - - docker buildx build \ - -f "$GIT_ROOT/Dockerfile" \ - --target "$target" \ - --tag "${DOCKER_IMAGE_ROOT}/$name:$version" \ - --tag "${DOCKER_IMAGE_ROOT}/$name:latest" \ - --tag "ghcr.io/${DOCKER_IMAGE_ROOT}/$name:$version" \ - --tag "ghcr.io/${DOCKER_IMAGE_ROOT}/$name:latest" \ - --build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \ - "$@" . -} - -#for containers in base android dart golang haskell nodejs python ruby rust sbt spm binaries runtime; do -# Base -image_build ort-base-image base "$UBUNTU_VERSION" --build-arg JAVA_VERSION="$JAVA_VERSION" "$@" - -# Python -image_build python python "$PYTHON_VERSION" \ - --build-arg PYTHON_VERSION="$PYTHON_VERSION" \ - --build-arg CONAN_VERSION="$CONAN_VERSION" \ - --build-arg PYTHON_INSPECTOR_VERSION="$PYTHON_INSPECTOR_VERSION" \ - --build-arg PYTHON_PIPENV_VERSION="$PYTHON_PIPENV_VERSION" \ - --build-arg PYTHON_POETRY_VERSION="$PYTHON_POETRY_VERSION" \ - --build-arg PIPTOOL_VERSION="$PIPTOOL_VERSION" \ - --build-arg SCANCODE_VERSION="$SCANCODE_VERSION" \ - "$@" - -# Ruby -image_build ruby ruby "$RUBY_VERSION" \ - --build-arg RUBY_VERSION="$RUBY_VERSION" \ - --build-arg COCOAPODS_VERSION="$COCOAPODS_VERSION" \ - "$@" - -# Nodejs -image_build nodejs nodejs "$NODEJS_VERSION" \ - --build-arg NODEJS_VERSION="$NODEJS_VERSION" \ - --build-arg BOWER_VERSION="$BOWER_VERSION" \ - --build-arg NPM_VERSION="$NPM_VERSION" \ - --build-arg PNPM_VERSION="$PNPM_VERSION" \ - --build-arg YARN_VERSION="$YARN_VERSION" \ - "$@" - -# Rust -image_build rust rust "$RUST_VERSION" \ - --build-arg RUST_VERSION="$RUST_VERSION" \ - "$@" - -# Golang -image_build golang golang "$GO_VERSION" \ - --build-arg GO_VERSION="$GO_VERSION" \ - --build-arg GO_DEP_VERSION="$GO_DEP_VERSION" \ - "$@" - -# Haskell -image_build haskell haskell "$HASKELL_STACK_VERSION" \ - --build-arg HASKELL_STACK_VERSION="$HASKELL_STACK_VERSION" \ - "$@" - -# Android -image_build android android "$ANDROID_CMD_VERSION" \ - --build-arg ANDROID_CMD_VERSION="$ANDROID_CMD_VERSION" \ - "$@" - -# Dart -image_build dart dart "$DART_VERSION" \ - --build-arg DART_VERSION="$DART_VERSION" \ - "$@" - -# SBT -image_build sbt sbt "$SBT_VERSION" \ - --build-arg SBT_VERSION="$SBT_VERSION" \ - "$@" - -# Spm -image_build spm spm "$SWIFT_VERSION" \ - --build-arg SWIFT_VERSION="$SWIFT_VERSION" \ - "$@" - -# Ort -image_build ort binaries "$GIT_REVISION" \ - --build-arg ORT_VERSION="$GIT_REVISION" \ - "$@" - -# Runtime ORT image -image_build run ort "$GIT_REVISION" \ - --build-context "python=docker-image://${DOCKER_IMAGE_ROOT}/python:latest" \ - --build-context "ruby=docker-image://${DOCKER_IMAGE_ROOT}/ruby:latest" \ - --build-context "python=docker-image://${DOCKER_IMAGE_ROOT}/python:latest" \ - --build-arg NODEJS_VERSION="$NODEJS_VERSION" \ - --build-context "nodejs=docker-image://${DOCKER_IMAGE_ROOT}/nodejs:latest" \ - --build-context "rust=docker-image://${DOCKER_IMAGE_ROOT}/rust:latest" \ - --build-context "golang=docker-image://${DOCKER_IMAGE_ROOT}/golang:latest" \ - --build-context "haskell=docker-image://${DOCKER_IMAGE_ROOT}/haskell:latest" \ - --build-context "android=docker-image://${DOCKER_IMAGE_ROOT}/android:latest" \ - --build-context "dart=docker-image://${DOCKER_IMAGE_ROOT}/dart:latest" \ - --build-context "sbt=docker-image://${DOCKER_IMAGE_ROOT}/sbt:latest" \ - --build-context "spm=docker-image://${DOCKER_IMAGE_ROOT}/spm:latest" \ - --build-context "ort=docker-image://${DOCKER_IMAGE_ROOT}/binaries:latest" \ - --build-arg COMPOSER_VERSION="$COMPOSER_VERSION" \ - --build-arg NUGET_INSPECTOR_VERSION="$NUGET_INSPECTOR_VERSION" \ - --tag "ghcr.io/vwdfive/ort:latest" -"$@" diff --git a/scripts/docker_snippets/android.snippet b/scripts/docker_snippets/android.snippet index 59b33f357e088..bbf9908b0fe8f 100644 --- a/scripts/docker_snippets/android.snippet +++ b/scripts/docker_snippets/android.snippet @@ -21,6 +21,6 @@ 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 +RUN sudo chmod -R o+rw $ANDROID_HOME RUN syft $ANDROID_HOME -o spdx-json --file /usr/share/doc/ort/ort-android.spdx.json diff --git a/scripts/docker_snippets/haskell.snippet b/scripts/docker_snippets/haskell.snippet index b974d2937c661..4594de4e4e1de 100644 --- a/scripts/docker_snippets/haskell.snippet +++ b/scripts/docker_snippets/haskell.snippet @@ -15,18 +15,10 @@ # SPDX-License-Identifier: Apache-2.0 # License-Filename: LICENSE -ARG HASKELL_STACK_VERSION=2.7.5 +# Haskell ENV HASKELL_HOME=/opt/haskell ENV PATH=$PATH:$HASKELL_HOME/bin -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - sudo apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \ - zlib1g-dev \ - && sudo rm -rf /var/lib/apt/lists/* +COPY --from=ghcr.io/oss-review-toolkit/haskell /opt/haskell /opt/haskell -RUN curl -sSL https://get.haskellstack.org/ | bash -s -- -d $HASKELL_HOME/bin - -FROM scratch AS haskell -COPY --from=haskellbuild /opt/haskell /opt/haskell \ No newline at end of file +RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json \ No newline at end of file