diff --git a/Dockerfile b/Dockerfile index 826b19c..24be6a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,14 @@ -# This image is the base image for all s2i configurable Docker images. +# This image is the base image for all s2i configurable container images. FROM registry.fedoraproject.org/fedora:27 -ENV SUMMARY='Base image which allows using of source-to-image.' DESCRIPTION='The s2i-core image provides any images layered on top of it with all the tools needed to use source-to-image functionality while keeping the image size as small as possible.' NAME=s2i-core VERSION=0 RELEASE=17 ARCH=x86_64 +ENV SUMMARY="Base image which allows using of source-to-image." \ + DESCRIPTION="The s2i-core image provides any images layered on top of it \ +with all the tools needed to use source-to-image functionality while keeping \ +the image size as small as possible." \ + NAME=s2i-core \ + VERSION=0 \ + RELEASE=1 \ + ARCH=x86_64 LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ @@ -34,7 +41,7 @@ ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ ENV=${APP_ROOT}/etc/scl_enable \ PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable" -# This is the list of basic dependencies that all language Docker image can +# This is the list of basic dependencies that all language container image can # consume. # Also setup the 'openshift' user that is used for the build execution and for the # application runtime execution. @@ -42,6 +49,7 @@ ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \ RUN INSTALL_PKGS="bsdtar \ findutils \ gettext \ + groff \ tar \ unzip" && \ mkdir -p ${HOME}/.pki/nssdb && \ diff --git a/root/usr/bin/prepare-yum-repositories b/root/usr/bin/prepare-yum-repositories index b604880..850701b 100755 --- a/root/usr/bin/prepare-yum-repositories +++ b/root/usr/bin/prepare-yum-repositories @@ -2,7 +2,7 @@ # This script is used to prepare yum repositories, that are given as arguments. -set -e +set -ex # DEFAULT_REPOS and SKIP_REPOS_{ENABLE,DISABLE} are intentionally undocumented, # but might be used if we need to change this behaviour. @@ -20,8 +20,8 @@ function is_subscribed() { return 1 } -# repo files might be mounted in (read-only), better not try any write ops -ls -1 /etc/yum.repos.d/ | grep -v redhat.repo >/dev/null && SKIP_REPOS_ENABLE=true +# if redhat.repo does not exist we have a mounted-in dir, do not enable repositories +[ -f /etc/yum.repos.d/redhat.repo ] || SKIP_REPOS_ENABLE=true # install yum-utils for yum-config-manager yum install -y yum-utils @@ -29,11 +29,20 @@ yum install -y yum-utils if [ "$SKIP_REPOS_DISABLE" = false ] && is_subscribed; then # Disable only repos that might come from subscribed host, because there # might be other repos provided by user or build system - echo "Running: yum-config-manager --disable rhel-\*" - yum-config-manager --disable rhel-\* &> /dev/null || : + + disable_repos= + # Lines look like: "Repo-id : dist-tag-override/x86_64" + while IFS=' /' read -r _ _ repo_id _; do + case $repo_id in rhel-*) + disable_repos+=" $repo_id" ;; + esac + done <<<"$(yum repolist -v 2>/dev/null | grep Repo-id)" + + if test -n "$disable_repos"; then + yum-config-manager --disable $disable_repos &> /dev/null + fi fi if [ ${SKIP_REPOS_ENABLE} = false ] && [ -n "${DEFAULT_REPOS}" -o $# -gt 0 ] ; then - echo "Running: yum-config-manager --enable ${DEFAULT_REPOS} $@" yum-config-manager --enable ${DEFAULT_REPOS} "$@" fi