Skip to content

Commit 9d534eb

Browse files
committed
Consolidate RUN for gcc install with other RUN
1 parent 6e3312c commit 9d534eb

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

docker/debian/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,14 @@ FROM base AS clang
158158
# This is not inherited from base image, ensure no manual interaction needed.
159159
ARG DEBIAN_FRONTEND=noninteractive
160160

161-
# Some build dependencies require GCC to be also available.
162-
RUN <<EOF
163-
apt-get update
164-
apt-get install -y --no-install-recommends gcc g++
165-
apt-get clean
166-
rm -rf /var/lib/apt/lists/*
167-
EOF
168-
169161
# Install Clang. Use the LLVM apt repository to access the latest versions. We
170162
# must repeat the DEBIAN_VERSION argument here, as it is not inherited from the
171-
# base or source images.
163+
# base or source images. Some build dependencies require GCC to be also available.
172164
ARG DEBIAN_VERSION
173165
ARG CLANG_VERSION
174166
RUN <<EOF
167+
apt-get update
168+
apt-get install -y --no-install-recommends gcc g++
175169
curl --no-progress-meter https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /etc/apt/keyrings/llvm.gpg
176170
printf "%s\n%s\n" \
177171
"deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \

docker/ubuntu/Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,15 @@ FROM base AS clang
143143
# This is not inherited from base image, ensure no manual interaction needed.
144144
ARG DEBIAN_FRONTEND=noninteractive
145145

146-
# Some build dependencies require GCC to be also available.
147-
RUN <<EOF
148-
apt-get update
149-
apt-get install -y --no-install-recommends gcc g++
150-
apt-get clean
151-
rm -rf /var/lib/apt/lists/*
152-
EOF
153-
154-
# Install Clang.
146+
# Install Clang. Some build dependencies require GCC to be also available.
155147
ARG CLANG_VERSION
156148
RUN <<EOF
157149
apt-get update
158150
apt-get install -y --no-install-recommends \
159151
clang-${CLANG_VERSION} \
160-
llvm-${CLANG_VERSION}
152+
llvm-${CLANG_VERSION} \
153+
gcc \
154+
g++
161155
apt-get clean
162156
rm -rf /var/lib/apt/lists/*
163157
update-alternatives \

0 commit comments

Comments
 (0)