|
| 1 | +# Copyright (C) 2020 Bosch Software Innovations GmbH |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | +# License-Filename: LICENSE |
| 17 | + |
| 18 | +FROM frolvlad/alpine-java:jdk8-slim AS build |
| 19 | + |
| 20 | +COPY . /usr/local/src/ort |
| 21 | + |
| 22 | +WORKDIR /usr/local/src/ort |
| 23 | + |
| 24 | +RUN apk add --no-cache \ |
| 25 | + # Required for Node.js to build the reporter-web-app. |
| 26 | + libstdc++ \ |
| 27 | + # Required to allow to download via a proxy with a self-signed certificate. |
| 28 | + ca-certificates coreutils openssl && \ |
| 29 | + scripts/import_proxy_certs.sh |
| 30 | + |
| 31 | +RUN scripts/set_gradle_proxy.sh && \ |
| 32 | + ./gradlew --no-daemon :cli:distTar |
| 33 | + |
| 34 | +FROM openjdk:11-jre-slim-sid |
| 35 | + |
| 36 | +ENV \ |
| 37 | + # Package manager versions. |
| 38 | + BOWER_VERSION=1.8.8 \ |
| 39 | + BUNDLER_VERSION=1.17.3-3 \ |
| 40 | + CARGO_VERSION=0.40.0-3 \ |
| 41 | + COMPOSER_VERSION=1.9.1-1 \ |
| 42 | + CONAN_VERSION=1.18.0 \ |
| 43 | + FLUTTER_VERSION=v1.7.8+hotfix.3-stable \ |
| 44 | + GO_DEP_VERSION=0.5.4-3 \ |
| 45 | + GO_VERSION=1.13.4 \ |
| 46 | + HASKELL_STACK_VERSION=1.7.1-3 \ |
| 47 | + NPM_VERSION=6.13.4+ds-2 \ |
| 48 | + PYTHON_PIP_VERSION=18.1-5 \ |
| 49 | + PYTHON_PIPENV_VERSION=2018.11.26 \ |
| 50 | + PYTHON_VIRTUALENV_VERSION=15.1.0 \ |
| 51 | + SBT_VERSION=0.13.13-2 \ |
| 52 | + YARN_VERSION=1.21.1 \ |
| 53 | + # Scanner versions. |
| 54 | + SCANCODE_VERSION=3.0.2 \ |
| 55 | + # Installation directories. |
| 56 | + FLUTTER_HOME=/opt/flutter |
| 57 | + |
| 58 | +ENV PATH="$PATH:$FLUTTER_HOME/bin:$FLUTTER_HOME/bin/cache/dart-sdk/bin:/opt/go/bin" |
| 59 | + |
| 60 | +# Apt install commands. |
| 61 | +RUN apt-get update && \ |
| 62 | + apt-get install -y --no-install-recommends \ |
| 63 | + # Install general tools required by this Dockefile. |
| 64 | + curl \ |
| 65 | + lib32stdc++6 \ |
| 66 | + openssh-client \ |
| 67 | + # Install VCS tools (no specific versions required here). |
| 68 | + cvs \ |
| 69 | + git \ |
| 70 | + mercurial \ |
| 71 | + # Install package managers (in versions known to work). |
| 72 | + bundler=$BUNDLER_VERSION \ |
| 73 | + cargo=$CARGO_VERSION \ |
| 74 | + composer=$COMPOSER_VERSION \ |
| 75 | + go-dep=$GO_DEP_VERSION \ |
| 76 | + haskell-stack=$HASKELL_STACK_VERSION \ |
| 77 | + npm=$NPM_VERSION \ |
| 78 | + python-pip=$PYTHON_PIP_VERSION \ |
| 79 | + python-setuptools \ |
| 80 | + python3-pip=$PYTHON_PIP_VERSION \ |
| 81 | + python3-setuptools \ |
| 82 | + sbt=$SBT_VERSION \ |
| 83 | + && \ |
| 84 | + rm -rf /var/lib/apt/lists/* |
| 85 | + |
| 86 | +# Custom install commands. |
| 87 | +RUN \ |
| 88 | + # Install VCS tools (no specific versions required here). |
| 89 | + curl -ksS https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo && \ |
| 90 | + chmod a+x /usr/local/bin/repo && \ |
| 91 | + # Install package managers (in versions known to work). |
| 92 | + npm install --global bower@$BOWER_VERSION yarn@$YARN_VERSION && \ |
| 93 | + pip install wheel && \ |
| 94 | + pip install conan==$CONAN_VERSION pipenv==$PYTHON_PIPENV_VERSION virtualenv==$PYTHON_VIRTUALENV_VERSION && \ |
| 95 | + curl -ksSO https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_$FLUTTER_VERSION.tar.xz && \ |
| 96 | + tar xf flutter_linux_$FLUTTER_VERSION.tar.xz -C $(dirname $FLUTTER_HOME) && \ |
| 97 | + rm flutter_linux_$FLUTTER_VERSION.tar.xz && \ |
| 98 | + chmod -R a+rw $FLUTTER_HOME && \ |
| 99 | + flutter config --no-analytics && \ |
| 100 | + flutter doctor && \ |
| 101 | + # Install golang in order to have `go mod` as package manager. |
| 102 | + curl -ksSO https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz && \ |
| 103 | + tar -C /opt -xzf go$GO_VERSION.linux-amd64.tar.gz && \ |
| 104 | + rm go$GO_VERSION.linux-amd64.tar.gz && \ |
| 105 | + # Add scanners (in versions known to work). |
| 106 | + curl -ksSL https://github.com/nexB/scancode-toolkit/archive/v$SCANCODE_VERSION.tar.gz | \ |
| 107 | + tar -zxC /usr/local && \ |
| 108 | + # Trigger configuration for end-users. |
| 109 | + /usr/local/scancode-toolkit-$SCANCODE_VERSION/scancode --version && \ |
| 110 | + chmod -R o=u /usr/local/scancode-toolkit-$SCANCODE_VERSION && \ |
| 111 | + ln -s /usr/local/scancode-toolkit-$SCANCODE_VERSION/scancode /usr/local/bin/scancode |
| 112 | + |
| 113 | +COPY --from=build /usr/local/src/ort/cli/build/distributions/ort-*.tar /opt/ort.tar |
| 114 | +RUN mkdir /opt/ort && tar xf /opt/ort.tar -C /opt/ort --strip-components 1 |
| 115 | + |
| 116 | +ENTRYPOINT ["/opt/ort/bin/ort"] |
0 commit comments