From 0b04fe41caf79c06cfce56cd80731e072853fe3b Mon Sep 17 00:00:00 2001 From: Jeff Harvey-Smith Date: Thu, 3 Oct 2024 10:15:37 -0700 Subject: [PATCH] [BACKPORT 2024.1.3]Fix UBI image: Add -y option to install of hostname Summary: Original commit: fa3815268dce56faf25f0da9e532fb1e3fc31714 / D38602 dnf install hostname was failing waiting for user interaction. Add the -y option to avoid that. Test Plan: Built the UBI:8 image locally Reviewers: devops, dshubin, steve.varnau Reviewed By: steve.varnau Subscribers: devops Differential Revision: https://phorge.dev.yugabyte.com/D38680 --- docker/images/yugabyte/Dockerfile | 64 +++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/docker/images/yugabyte/Dockerfile b/docker/images/yugabyte/Dockerfile index bd25ce25a41d..c1f66379ad32 100644 --- a/docker/images/yugabyte/Dockerfile +++ b/docker/images/yugabyte/Dockerfile @@ -46,31 +46,53 @@ ENV YB_DEVOPS_USE_PYTHON3=1 WORKDIR $YB_HOME # Create some yum aliases for use in this Dockerfile -ARG yum_install="yum install --disableplugin=subscription-manager" -ARG yum_upgrade="yum upgrade --disableplugin=subscription-manager" +ARG yum_install="yum install --disableplugin=subscription-manager -y" +ARG yum_upgrade="yum upgrade --disableplugin=subscription-manager -y" + +# Add the almalinux8 package repo if we are building for ubi. +RUN < /etc/yum.repos.d/almalinux8.repo +[almalinux8-appstream] +name=Almalinux8-appstream +baseurl=https://repo.almalinux.org/almalinux/8/AppStream/$basearch/os/ +gpgcheck=1 +enabled=1 +gpgkey=https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-8 + +[almalinux8-baseos] +name=Almalinux8-baseos +baseurl=https://repo.almalinux.org/almalinux/8/BaseOS/$basearch/os/ +gpgcheck=1 +enabled=1 +gpgkey=https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-8 +EOR + fi +EOF + +# Install hostname for ubi8 images. +RUN if [[ "$BASE_IMAGE" == "registry.access.redhat.com/ubi8/ubi"* ]]; then \ + $yum_install hostname; \ + fi + +# Ensure our base system is fully up to date +RUN set -x; \ + $yum_upgrade \ + && rm -rf ~/.cache \ + && yum clean all && rm -rf /var/cache/yum # Install required python packages first # this should leave us with python3.8 as the default python3 RUN set -x ; \ - if [[ "$BASE_IMAGE" == "centos:7" ]]; then \ - $yum_install -y install centos-release-scl-rh && \ - yum_install="$yum_install --enablerepo=centos-sclo-rh"; \ - fi && \ - if [[ "$BASE_IMAGE" == "registry.access.redhat.com/ubi7/ubi"* \ - || "$BASE_IMAGE" == "centos:7" ]]; then \ - $yum_install -y \ - rh-python38 \ - rh-python38-python-setuptools \ - rh-python38-python-devel \ - rh-python38-python-pip \ - rh-python38-python-psutil \ - && echo "source /opt/rh/rh-python38/enable" >> /etc/bashrc \ - && source /opt/rh/rh-python38/enable; \ - else \ - $yum_install -y \ - python38-devel \ - python38-pip \ - python38-psutil; \ + $yum_install \ + python38-devel \ + python38-pip \ + python38-psutil \ + && pip3 install --upgrade pip \ + && pip3 install --upgrade lxml \ + && pip3 install --upgrade s3cmd \ + && if [[ "$(uname -m)" == "x86_64" ]]; then \ + pip3 install --upgrade psutil; \ fi \ && pip3 install --upgrade pip \ && pip3 install --upgrade lxml