diff --git a/docker/CMakeLists.txt b/docker/CMakeLists.txt index 90fa34cc4..508e11199 100644 --- a/docker/CMakeLists.txt +++ b/docker/CMakeLists.txt @@ -101,13 +101,13 @@ if (NOT ${DISTRO_BASE_IMAGE} STREQUAL "UNSUPPORTED") VERBATIM ) endfunction() - add_base_image(release "" "") - add_base_image(release_java11 "" "--java 11") - add_base_image(release_java17 "" "--java 17") - # Debug images include debug tools - add_base_image(debug "--debug-build" "--install-debug-tools") - add_base_image(debug_java11 "--debug-build" "--install-debug-tools --java 11") - add_base_image(debug_java17 "--debug-build" "--install-debug-tools --java 17") + add_base_image(release "" "--install-debug-tools basic") + add_base_image(release_java11 "" "--install-debug-tools basic --java 11") + add_base_image(release_java17 "" "--install-debug-tools basic --java 17") + # Debug images include full debug tools + add_base_image(debug "--debug-build" "--install-debug-tools full") + add_base_image(debug_java11 "--debug-build" "--install-debug-tools full --java 11") + add_base_image(debug_java17 "--debug-build" "--install-debug-tools full --java 17") # Target to build all docker images. Dependencies are added for each docker image # instantiated below. diff --git a/docker/impala_base/Dockerfile b/docker/impala_base/Dockerfile index 7b1b5963c..2d84d2514 100644 --- a/docker/impala_base/Dockerfile +++ b/docker/impala_base/Dockerfile @@ -19,8 +19,8 @@ ARG BASE_IMAGE=REPLACED_WITH_BASE_IMAGE FROM ${BASE_IMAGE} -# If set to "--install-debug-tools", then extra utilities will be installed. -ARG INSTALL_OS_PACKAGES_ARGS="" +# The level of debugging tools to install is set by the argument to "--install-debug-tools". +ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools none" # Install minimal dependencies required for Impala services to run. ADD helper/install_os_packages.sh /root diff --git a/docker/impala_profile_tool/Dockerfile b/docker/impala_profile_tool/Dockerfile index d6f21c194..78fcae827 100644 --- a/docker/impala_profile_tool/Dockerfile +++ b/docker/impala_profile_tool/Dockerfile @@ -19,8 +19,8 @@ ARG BASE_IMAGE=REPLACED_WITH_BASE_IMAGE FROM ${BASE_IMAGE} -# If set to "--install-debug-tools", then extra utilities will be installed -ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools" +# If set to "--install-debug-tools full", then extra utilities will be installed. +ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools full" # Install dependencies required for Impala utility binaries to run, plus # some useful utilities. diff --git a/docker/install_os_packages.sh b/docker/install_os_packages.sh index 8fbeef793..c8c419aba 100755 --- a/docker/install_os_packages.sh +++ b/docker/install_os_packages.sh @@ -23,7 +23,9 @@ set -euo pipefail -INSTALL_DEBUG_TOOLS=false +# Default level of extra debugging tools, controlled by the --install-debug-tools flag. +INSTALL_DEBUG_TOOLS=none + JAVA_VERSION=8 DRY_RUN=false PKG_LIST="" @@ -31,7 +33,8 @@ NON_PKG_NAMES=(apt-get yum install update) function print_usage { echo "install_os_packages.sh - Helper script to install OS dependencies" - echo "[--install-debug-tools] : Also install debug tools like curl, iproute, etc" + echo "[--install-debug-tools ] : set the level of debug tools"\ + "to install" echo "[--java ] : Use specified Java version rather than the default Java 8." echo "[--dry-run] : Print the list of packages to install." } @@ -61,7 +64,8 @@ while [ -n "$*" ] do case "$1" in --install-debug-tools) - INSTALL_DEBUG_TOOLS=true + INSTALL_DEBUG_TOOLS="${2-}" + shift; ;; --java) JAVA_VERSION="${2-}" @@ -82,6 +86,18 @@ echo "INSTALL_DEBUG_TOOLS=${INSTALL_DEBUG_TOOLS}" echo "JAVA_VERSION=${JAVA_VERSION}" echo "DRY_RUN=${DRY_RUN}" +case "$INSTALL_DEBUG_TOOLS" in + none | basic | full) + # These are valid. + ;; + "" | *) + # The argument to --install-debug-tools is either missing, or is not a recognized + # value. + print_usage + exit 1 + ;; +esac + # This can get more detailed if there are specific steps # for specific versions, but at the moment the distribution # is all we need. @@ -124,8 +140,11 @@ if [[ $DISTRIBUTION == Ubuntu ]]; then libsasl2-modules-gssapi-mit \ openjdk-${JAVA_VERSION}-jre-headless \ tzdata - if $INSTALL_DEBUG_TOOLS ; then - echo "Installing extra debug tools" + + # On Ubuntu there are no extra tools installed for $INSTALL_DEBUG_TOOLS == basic + + if [[ $INSTALL_DEBUG_TOOLS == full ]]; then + echo "Installing full debug tools" wrap apt-get install -y \ curl \ dnsutils \ @@ -159,8 +178,15 @@ elif [[ $DISTRIBUTION == Redhat ]]; then langpacks-en fi - if $INSTALL_DEBUG_TOOLS ; then - echo "Installing extra debug tools" + if [[ $INSTALL_DEBUG_TOOLS == basic || $INSTALL_DEBUG_TOOLS == full ]]; then + echo "Installing basic debug tools" + wrap yum install -y --disableplugin=subscription-manager \ + java-${JAVA_VERSION}-openjdk-devel \ + gdb + fi + + if [[ $INSTALL_DEBUG_TOOLS == full ]]; then + echo "Installing full debug tools" wrap yum install -y --disableplugin=subscription-manager \ bind-utils \ curl \