Skip to content

Commit ec2d7a6

Browse files
authored
Add ccache (#85)
This change adds `ccache` to the Debian, Ubuntu, and RHEL images, so our CI pipelines can take advantage of caching (once configured to do so). Note that due to our use of the UBI images of RHEL, the `ccache` package cannot be installed using the default repositories available through the package manager. I first tried installing it by pulling it from from GitHub, however that required installing an appropriate versioning for each RHEL distro as otherwise GLIBC incompatibilities would surface. Instead, I added the RHEL version-specific Fedora EPEL repository, which is a project that provides RHEL-compatible packages, as that will install a compatible `ccache` version. To get a better view of which version is installed of which package, including `ccache`, they are now printed together at the end of each base image. This also acts as a sanity-check that the packages are actually installed.
1 parent 0525eae commit ec2d7a6

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

docker/debian/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN <<EOF
4040
pkgs=()
4141
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
4242
pkgs+=(binutils-gold) # Required build tool.
43+
pkgs+=(ccache) # Optional build tool for caching build artifacts.
4344
pkgs+=(curl) # Dependency for tools requiring downloading data.
4445
pkgs+=(dpkg-dev) # Required packaging tool.
4546
pkgs+=(debhelper) # Required packaging tool.
@@ -62,8 +63,6 @@ apt-get clean
6263
rm -rf /var/lib/apt/lists/*
6364
EOF
6465

65-
RUN ld.gold --version
66-
6766
# Install Python-based tools and cmake.
6867
ARG CONAN_VERSION
6968
ARG GCOVR_VERSION
@@ -85,7 +84,17 @@ ARCH=$(uname -m)
8584
wget -O mold.tar.gz https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-${ARCH}-linux.tar.gz
8685
tar -xzf mold.tar.gz --strip-components=1 -C /usr/local
8786
rm mold.tar.gz
87+
EOF
88+
89+
# Print versions.
90+
RUN <<EOF
91+
ccache --version
92+
cmake --version
93+
conan --version
94+
gcovr --version
95+
ld.gold --version
8896
mold --version
97+
python3 --version
8998
EOF
9099

91100
# ====================== GCC IMAGE ======================

docker/rhel/Dockerfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ ENTRYPOINT ["/bin/bash"]
1010
# This is not inherited from the base image.
1111
ARG RHEL_VERSION
1212

13+
# Install the Fedora Extra Packages for Enterprise Linux (EPEL) repository,
14+
# which provides additional packages for RHEL and CentOS Stream, some of which
15+
# we want to install.
16+
RUN <<EOF
17+
dnf install -y --setopt=tsflags=nodocs https://dl.fedoraproject.org/pub/epel/epel-release-latest-${RHEL_VERSION}.noarch.rpm
18+
dnf clean -y all
19+
rm -rf /var/cache/dnf/*
20+
EOF
21+
1322
# Install tools that are shared by all stages.
1423
RUN <<EOF
1524
pkgs=()
@@ -19,6 +28,7 @@ if [ "${RHEL_VERSION}" -eq "8" ]; then
1928
else
2029
pkgs+=(binutils-gold) # Required build tool.
2130
fi
31+
pkgs+=(ccache) # Optional build tool for caching build artifacts.
2232
pkgs+=(file) # Required packaging tool.
2333
pkgs+=(git) # Required build tool.
2434
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
@@ -67,8 +77,6 @@ mkdir -p /usr/local/lib
6777
ln -sf /usr/lib/python3.12 /usr/local/lib/python3.12
6878
EOF
6979

70-
RUN ld.gold --version
71-
7280
# Install Python-based tools and cmake.
7381
ARG CONAN_VERSION
7482
ARG GCOVR_VERSION
@@ -90,7 +98,17 @@ ARCH=$(uname -m)
9098
wget -O mold.tar.gz https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-${ARCH}-linux.tar.gz
9199
tar -xzf mold.tar.gz --strip-components=1 -C /usr/local
92100
rm mold.tar.gz
101+
EOF
102+
103+
# Print versions.
104+
RUN <<EOF
105+
ccache --version
106+
cmake --version
107+
conan --version
108+
gcovr --version
109+
ld.gold --version
93110
mold --version
111+
python3 --version
94112
EOF
95113

96114
# ====================== GCC IMAGE ======================

docker/ubuntu/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN <<EOF
2727
pkgs=()
2828
pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by providing trusted root certificates.
2929
pkgs+=(binutils-gold) # Required build tool.
30+
pkgs+=(ccache) # Optional build tool for caching build artifacts.
3031
pkgs+=(curl) # Dependency for tools requiring downloading data.
3132
pkgs+=(dpkg-dev) # Required packaging tool.
3233
pkgs+=(file) # Required packaging tool.
@@ -48,8 +49,6 @@ apt-get clean
4849
rm -rf /var/lib/apt/lists/*
4950
EOF
5051

51-
RUN ld.gold --version
52-
5352
# Install Python-based tools and cmake.
5453
ARG CONAN_VERSION
5554
ARG GCOVR_VERSION
@@ -71,7 +70,17 @@ ARCH=$(uname -m)
7170
wget -O mold.tar.gz https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-${ARCH}-linux.tar.gz
7271
tar -xzf mold.tar.gz --strip-components=1 -C /usr/local
7372
rm mold.tar.gz
73+
EOF
74+
75+
# Print versions.
76+
RUN <<EOF
77+
ccache --version
78+
cmake --version
79+
conan --version
80+
gcovr --version
81+
ld.gold --version
7482
mold --version
83+
python3 --version
7584
EOF
7685

7786
# ====================== GCC IMAGE ======================

0 commit comments

Comments
 (0)