Skip to content

Commit d2b51fd

Browse files
committed
docker: Add a new multi-stage Docker file with proxy support
This combines the functionality of docker/build/Dockerfile and docker/run/Dockerfile into a single file for convenience, and to be able to use it in environments like GitHub actions which support only a single Docker file. The dockerignore file was optimized with the help of https://github.com/pwaller/docker-show-context. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent d46ad71 commit d2b51fd

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed

.dockerignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Ignore the Docker files themselves to avoid that all layers are invalidated if
2+
# the Docker files are changed during development.
3+
.dockerignore
4+
Dockerfile
5+
6+
# Ignore the Git directory.
7+
.git/
8+
9+
# Ignore IntelliJ IDEA files.
10+
.idea/
11+
*.iml
12+
13+
# Ignore intermediate build artifacts.
14+
**/.gradle/
15+
**/.kotlintest/
16+
**/build/
17+
!docker/build
18+
**/out/
19+
reporter-web-app/node_modules/
20+
21+
# Ignore the logos as we do not need them to run ORT.
22+
logos/
23+
24+
# Ignore test directories as we do not need them to run ORT.
25+
**/*[Tt]est/
26+
27+
# Ignore macOS-specific files.
28+
.DS_Store

Dockerfile

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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

Comments
 (0)