Skip to content

Commit

Permalink
[BACKPORT 2024.1.3]Fix UBI image: Add -y option to install of hostname
Browse files Browse the repository at this point in the history
Summary:
Original commit: fa38152 / 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
  • Loading branch information
jharveysmith committed Oct 3, 2024
1 parent 8051240 commit 0b04fe4
Showing 1 changed file with 43 additions and 21 deletions.
64 changes: 43 additions & 21 deletions docker/images/yugabyte/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
if [[ "$BASE_IMAGE" == "registry.access.redhat.com/ubi8"* ]]; then
cat <<- "EOR" > /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
Expand Down

0 comments on commit 0b04fe4

Please sign in to comment.