Skip to content

Commit 54f59d1

Browse files
authored
Add Docker image for RHEL 10 (#59)
This change adds support for RHEL 10. At the moment no gcc-toolsets exist, and RHEL 10 comes bundled with GCC 14. Assuming gcc-toolsets will be added in the near future, this change therefore checks whether the image built is RHEL 9 (in which case it will install the requested GCC version using the gcc-toolset), or otherwise will install the default compiler (until some day we can revert this piece of conditional logic to also use the toolset).
1 parent 4ff492e commit 54f59d1

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

.github/workflows/rhel.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
- release: 9
4949
compiler_name: gcc
5050
compiler_version: 14
51+
- release: 10
52+
compiler_name: gcc
53+
compiler_version: 14
5154
- release: 9
5255
compiler_name: clang
5356
compiler_version: 'any'
@@ -148,6 +151,9 @@ jobs:
148151
- release: 9
149152
compiler_name: gcc
150153
compiler_version: 14
154+
- release: 10
155+
compiler_name: gcc
156+
compiler_version: 14
151157
- release: 9
152158
compiler_name: clang
153159
compiler_version: 'any'

docker/rhel/Dockerfile

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,31 @@ ARG RHEL_VERSION
9090
# where typically you would run `scl enable gcc-toolset-X` to open another Bash
9191
# shell with the GCC toolset enabled. To avoid having to do so, we delete the
9292
# default GCC packages first, and then reference the GCC toolset binaries
93-
# directly.
93+
# directly. Note: we only do so for RHEL 9, as no toolsets are available for
94+
# RHEL 10 at the moment, and the default GCC 14 is sufficient.
9495
RUN <<EOF
95-
dnf remove -y gcc gcc-c++
96-
dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
96+
if [ "${RHEL_VERSION}" -eq "9" ]; then
97+
dnf remove -y gcc gcc-c++
98+
dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
99+
update-alternatives \
100+
--install /usr/bin/cc cc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 999
101+
update-alternatives \
102+
--install /usr/bin/c++ c++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ 999
103+
update-alternatives \
104+
--install /usr/bin/gcc gcc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 100 \
105+
--slave /usr/bin/g++ g++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ \
106+
--slave /usr/bin/cpp cpp /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/cpp \
107+
--slave /usr/bin/gcov gcov /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov \
108+
--slave /usr/bin/gcov-dump gcov-dump /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-dump-${GCC_VERSION} \
109+
--slave /usr/bin/gcov-tool gcov-tool /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-tool-${GCC_VERSION}
110+
update-alternatives --auto cc
111+
update-alternatives --auto c++
112+
update-alternatives --auto gcc
113+
else
114+
dnf install -y --setopt=tsflags=nodocs gcc gcc-c++
115+
fi
97116
dnf clean -y all
98117
rm -rf /var/cache/dnf/*
99-
update-alternatives \
100-
--install /usr/bin/cc cc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 999
101-
update-alternatives \
102-
--install /usr/bin/c++ c++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ 999
103-
update-alternatives \
104-
--install /usr/bin/gcc gcc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 100 \
105-
--slave /usr/bin/g++ g++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ \
106-
--slave /usr/bin/cpp cpp /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/cpp \
107-
--slave /usr/bin/gcov gcov /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov \
108-
--slave /usr/bin/gcov-dump gcov-dump /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-dump-${GCC_VERSION} \
109-
--slave /usr/bin/gcov-tool gcov-tool /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-tool-${GCC_VERSION}
110-
update-alternatives --auto cc
111-
update-alternatives --auto c++
112-
update-alternatives --auto gcc
113118
EOF
114119
# Set the compiler environment variables to point to the GCC binaries.
115120
ENV CC=/usr/bin/gcc

0 commit comments

Comments
 (0)