Skip to content

Commit 42ec9e3

Browse files
authored
Add Python 3.12 to RHEL image (#28)
The Python version that comes with the RHEL image is 3.9, which has almost reached its EOL. This change adds Python 3.12 - the latest version available via the package manager - and updates the symlinks to switch to this new version.
1 parent debea54 commit 42ec9e3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docker/rhel/Dockerfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ FROM registry.redhat.io/ubi${RHEL_VERSION%.*}/ubi:${RHEL_VERSION} AS base
77
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
88
ENTRYPOINT ["/bin/bash"]
99

10-
# Update the packages installed on the system.
11-
RUN dnf update-minimal -y --security --sec-severity=Important --sec-severity=Critical
12-
1310
# Install tools that are shared by all stages.
1411
RUN <<EOF
1512
pkgs=()
@@ -23,17 +20,34 @@ pkgs+=(jq) # JSON manipulation.
2320
pkgs+=(libstdc++-static) # Required to statically link libraries into rippled.
2421
pkgs+=(ninja-build) # Required build tool.
2522
pkgs+=(perl-FindBin) # Required to compile OpenSSL.
23+
pkgs+=(python3.12) # Required build tool.
24+
pkgs+=(python3.12-pip) # Package manager for Python applications.
2625
pkgs+=(python3-jinja2) # Required build tool.
27-
pkgs+=(python3-pip) # Package manager for Python applications.
2826
pkgs+=(rpm-build) # Required packaging tool.
2927
pkgs+=(rpmdevtools) # Required packaging tool.
3028
pkgs+=(vim) # Text editor.
3129
pkgs+=(wget) # Required build tool.
30+
dnf update -y
3231
dnf install -y --allowerasing --setopt=tsflags=nodocs "${pkgs[@]}"
3332
dnf clean -y all
3433
rm -rf /var/cache/dnf/*
3534
EOF
3635

36+
# Add symlinks to point to the latest Python versions. The /usr/local/bin
37+
# directory is in the PATH before the /usr/bin directory, so the new Python
38+
# versions will be used by default.
39+
RUN <<EOF
40+
mkdir -p /usr/local/bin
41+
ln -sf /usr/bin/python3.12 /usr/local/bin/python3
42+
ln -sf /usr/bin/python3.12 /usr/local/bin/python
43+
ln -sf /usr/bin/pydoc3.12 /usr/local/bin/pydoc3
44+
ln -sf /usr/bin/pydoc3.12 /usr/local/bin/pydoc
45+
ln -sf /usr/bin/pip3.12 /usr/local/bin/pip3
46+
ln -sf /usr/bin/pip3.12 /usr/local/bin/pip
47+
mkdir -p /usr/local/lib
48+
ln -sf /usr/lib/python3.12 /usr/local/lib/python3.12
49+
EOF
50+
3751
# Install Python-based tools.
3852
ARG CONAN_VERSION
3953
ARG GCOVR_VERSION

0 commit comments

Comments
 (0)