Skip to content

Commit

Permalink
fix(docker): Haskell build was missed from extended components
Browse files Browse the repository at this point in the history
Signed-off-by: Helio Chissini de Castro <heliocastro@gmail.com>
  • Loading branch information
heliocastro committed Sep 8, 2023
1 parent 294b53b commit 5ab8997
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 13 deletions.
86 changes: 86 additions & 0 deletions Dockerfile-extended
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM ghcr.io/oss-review-toolkit/ort

# Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
# 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
5 changes: 3 additions & 2 deletions scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down Expand Up @@ -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" \
"$@"
14 changes: 3 additions & 11 deletions scripts/docker_snippets/haskell.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -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
RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json

0 comments on commit 5ab8997

Please sign in to comment.