Skip to content

Commit

Permalink
fix(docker): Match docker scripts to upstream image naming
Browse files Browse the repository at this point in the history
Change the build scripts to new minimal / ort images.
Naming had a slightly change from components as add to a subdomain
(ort/component) to a direct component naming, making equal to upstream
naming.

The explicit call to Dockerfile file name is not needed anymore, as
only a single Dockerfile exists after name changing.

Signed-off-by: Helio Chissini de Castro <[email protected]>
  • Loading branch information
heliocastro committed Nov 9, 2023
1 parent eb9e6e3 commit d3be821
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 51 deletions.
4 changes: 2 additions & 2 deletions scripts/custom_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ DOCKER_IMAGE_ROOT="${DOCKER_IMAGE_ROOT:-ghcr.io/oss-review-toolkit}"
valid_components=("android" "swift" "sbt" "dart" "dotnet" "php" "haskell")

# Define the Dockerfile template
dockerfile_template="FROM ghcr.io/oss-review-toolkit/ort\n"
dockerfile_template="FROM ${DOCKER_IMAGE_ROOT}/ort-minimal\n"

# Default output file
output_file="Dockerfile.custom"
output_file="Dockerfile-custom"

function usage() {
echo "Usage: $0 -c <component1> [<component2> ...] -o <output_file>"
Expand Down
94 changes: 45 additions & 49 deletions scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,127 +45,123 @@ image_build() {
shift

docker buildx build \
-f "$GIT_ROOT/Dockerfile" \
--target "$target" \
--tag "${DOCKER_IMAGE_ROOT}/$name:$version" \
--tag "${DOCKER_IMAGE_ROOT}/$name:latest" \
"$@" .
}

# Minimimal ORT image
# This is the base image for ORT and contains the minimal
# set of tools required to run ORT including main binaries.

# Base
image_build base ort/base "${JAVA_VERSION}-jdk-${UBUNTU_VERSION}" \
image_build base base "${JAVA_VERSION}-jdk-${UBUNTU_VERSION}" \
--build-arg UBUNTU_VERSION="$UBUNTU_VERSION" \
--build-arg JAVA_VERSION="$JAVA_VERSION" \
"$@"

# Python
image_build python ort/python "$PYTHON_VERSION" \
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" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Nodejs
image_build nodejs ort/nodejs "$NODEJS_VERSION" \
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" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Rust
image_build rust ort/rust "$RUST_VERSION" \
image_build rust rust "$RUST_VERSION" \
--build-arg RUST_VERSION="$RUST_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Ruby
image_build ruby ort/ruby "$RUBY_VERSION" \
image_build ruby ruby "$RUBY_VERSION" \
--build-arg RUBY_VERSION="$RUBY_VERSION" \
--build-arg COCOAPODS_VERSION="$COCOAPODS_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Golang
image_build golang ort/golang "$GO_VERSION" \
image_build golang golang "$GO_VERSION" \
--build-arg GO_VERSION="$GO_VERSION" \
--build-arg GO_DEP_VERSION="$GO_DEP_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Runtime ORT image
image_build run ort "$ORT_VERSION" \
image_build minimal ort-minimal "$ORT_VERSION" \
--build-arg ORT_VERSION="$ORT_VERSION" \
--build-arg NODEJS_VERSION="$NODEJS_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "python=docker-image://${DOCKER_IMAGE_ROOT}/ort/python:latest" \
--build-context "nodejs=docker-image://${DOCKER_IMAGE_ROOT}/ort/nodejs:latest" \
--build-context "rust=docker-image://${DOCKER_IMAGE_ROOT}/ort/rust:latest" \
--build-context "golang=docker-image://${DOCKER_IMAGE_ROOT}/ort/golang:latest" \
--build-context "ruby=docker-image://${DOCKER_IMAGE_ROOT}/ort/ruby:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
--build-context "python=docker-image://${DOCKER_IMAGE_ROOT}/python:latest" \
--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 "ruby=docker-image://${DOCKER_IMAGE_ROOT}/ruby:latest" \
"$@"

# Build adjacent language containers if ALL_LANGUAGES is set.
[ -z "$ALL_LANGUAGES" ] && exit 0

# Android
# shellcheck disable=SC1091
image_build android ort/android "$ANDROID_CMD_VERSION" \
image_build android android "$ANDROID_CMD_VERSION" \
--build-arg ANDROID_CMD_VERSION="$ANDROID_CMD_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Swift
image_build swift ort/swift "$SWIFT_VERSION" \
image_build swift swift "$SWIFT_VERSION" \
--build-arg SWIFT_VERSION="$SWIFT_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# SBT
image_build scala ort/scala "$SBT_VERSION" \
image_build scala scala "$SBT_VERSION" \
--build-arg SBT_VERSION="$SBT_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Dart
image_build dart ort/dart "$DART_VERSION" \
image_build dart dart "$DART_VERSION" \
--build-arg DART_VERSION="$DART_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Dotnet
image_build dotnet ort/dotnet "$DOTNET_VERSION" \
image_build dotnet dotnet "$DOTNET_VERSION" \
--build-arg DOTNET_VERSION="$DOTNET_VERSION" \
--build-arg NUGET_INSPECTOR_VERSION="$NUGET_INSPECTOR_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Haskell
image_build haskell ort/haskell "$HASKELL_STACK_VERSION" \
image_build haskell haskell "$HASKELL_STACK_VERSION" \
--build-arg HASKELL_STACK_VERSION="$HASKELL_STACK_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/base:latest" \
"$@"

# Runtime extended ORT image
docker buildx build \
--file Dockerfile-extended \
--tag "${DOCKER_IMAGE_ROOT}/ort-extended:$ORT_VERSION" \
--tag "${DOCKER_IMAGE_ROOT}/ort-extended:latest" \
# Main runtime ORT image
image_build run ort "$ORT_VERSION" \
--build-arg ORT_VERSION="$ORT_VERSION" \
--build-context "ort=docker-image://${DOCKER_IMAGE_ROOT}/ort:${ORT_VERSION}" \
--build-context "sbt=docker-image://${DOCKER_IMAGE_ROOT}/ort/sbt:latest" \
--build-context "dotnet=docker-image://${DOCKER_IMAGE_ROOT}/ort/dotnet:latest" \
--build-context "swift=docker-image://${DOCKER_IMAGE_ROOT}/ort/swift:latest" \
--build-context "android=docker-image://${DOCKER_IMAGE_ROOT}/ort/android:latest" \
--build-context "dart=docker-image://${DOCKER_IMAGE_ROOT}/ort/dart:latest" \
--build-context "haskell=docker-image://${DOCKER_IMAGE_ROOT}/ort/haskell:latest" \
--build-context "scala=docker-image://${DOCKER_IMAGE_ROOT}/ort/scala:latest" \
"$@" .

--build-context "minimal=docker-image://${DOCKER_IMAGE_ROOT}/ort-minimal:${ORT_VERSION}" \
--build-context "sbt=docker-image://${DOCKER_IMAGE_ROOT}/sbt:latest" \
--build-context "dotnet=docker-image://${DOCKER_IMAGE_ROOT}/dotnet:latest" \
--build-context "swift=docker-image://${DOCKER_IMAGE_ROOT}/swift:latest" \
--build-context "android=docker-image://${DOCKER_IMAGE_ROOT}/android:latest" \
--build-context "dart=docker-image://${DOCKER_IMAGE_ROOT}/dart:latest" \
--build-context "haskell=docker-image://${DOCKER_IMAGE_ROOT}/haskell:latest" \
--build-context "scala=docker-image://${DOCKER_IMAGE_ROOT}/scala:latest" \
"$@"

0 comments on commit d3be821

Please sign in to comment.