chore: Don't hardcode gcc version in ci/Dockerfile (#2337)

This commit is contained in:
Ayaz Salikhov
2025-07-17 15:52:51 +01:00
committed by GitHub
parent a8e61204da
commit 1b63c3c315
2 changed files with 15 additions and 12 deletions

View File

@@ -326,6 +326,7 @@ jobs:
build_args: | build_args: |
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }} GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }} CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }}
GCC_MAJOR_VERSION=${{ env.GCC_MAJOR_VERSION }}
GCC_VERSION=${{ env.GCC_VERSION }} GCC_VERSION=${{ env.GCC_VERSION }}
dockerhub_repo: rippleci/clio_ci dockerhub_repo: rippleci/clio_ci
dockerhub_description: CI image for XRPLF/clio. dockerhub_description: CI image for XRPLF/clio.

View File

@@ -60,27 +60,29 @@ RUN apt-get update \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install gcc-12 and make ldconfig aware of the new libstdc++ location (for gcc) ARG GCC_MAJOR_VERSION=invalid
# Install custom-built gcc and make ldconfig aware of the new libstdc++ location (for gcc)
# Note: Clang is using libc++ instead # Note: Clang is using libc++ instead
COPY --from=clio-gcc /gcc12.deb / COPY --from=clio-gcc /gcc${GCC_MAJOR_VERSION}.deb /
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \ && apt-get install -y --no-install-recommends --no-install-suggests \
binutils \ binutils \
libc6-dev \ libc6-dev \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& dpkg -i /gcc12.deb \ && dpkg -i /gcc${GCC_MAJOR_VERSION}.deb \
&& rm -rf /gcc12.deb \ && rm -rf /gcc${GCC_MAJOR_VERSION}.deb \
&& ldconfig && ldconfig
# Rewire to use gcc-12 as default compiler # Rewire to use our custom-built gcc as default compiler
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \ RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 \ && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 \ && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100 \ && update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12 100 \ && update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${GCC_MAJOR_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100 && update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${GCC_MAJOR_VERSION} 100
COPY --from=clio-tools \ COPY --from=clio-tools \
/usr/local/bin/mold \ /usr/local/bin/mold \