Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v10] Remove Clang from CentOS 7 Docker buildbox #13643

Merged
merged 3 commits into from
Jun 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions build.assets/Dockerfile-centos7
Original file line number Diff line number Diff line change
Expand Up @@ -53,79 +53,6 @@ RUN git clone --depth=1 https://github.com/Yubico/libfido2.git -b 1.11.0 && \
echo /usr/local/lib64 > /etc/ld.so.conf.d/libfido2.conf && \
ldconfig

FROM centos:7 AS centos-devtoolset

# Install required dependencies.
RUN yum groupinstall -y 'Development Tools' && \
yum install -y epel-release && \
yum update -y && \
yum -y install centos-release-scl-rh && \
yum install -y \
# required by libbpf, Clang
centos-release-scl \
# required by Clang/LLVM
cmake3 \
# required by libbpf and Clang
devtoolset-11-gcc* \
# required by libbpf
devtoolset-11-make \
# required by libbpf
elfutils-libelf-devel \
# required by libbpf
elfutils-libelf-devel-static \
git \
# required by libbpf, Clang
scl-utils \
# required by libbpf
zlib-devel \
# required by libbpf
zlib-static && \
yum clean all

# Use just created devtool image with newer GCC and Cmake
FROM centos-devtoolset as clang10

# Compile Clang 10.0.1 from source. It is needed to create BPF files.
# Centos 7 doesn't provide it as a package unfortunately.
# LLVM_INCLUDE_BENCHMARKS must be off, otherwise compilation fails,
# CLANG_BUILD_TOOLS must be on, it builds clang binary,
# LLVM_BUILD_TOOLS must be on, it builds llvm-strip binary.
# the rest is disabled to speedup the compilation.
RUN git clone --branch llvmorg-10.0.1 --depth=1 https://github.com/llvm/llvm-project.git && \
cd llvm-project/ && \
mkdir build && cd build/ && \
scl enable devtoolset-11 'bash -c "cmake3 \
-DCLANG_BUILD_TOOLS=ON \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/llvm \
-DLLVM_BUILD_TOOLS=ON \
-DLLVM_BUILD_UTILS=OFF \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_TOOL_LLI_BUILD=OFF \
-G \"Unix Makefiles\" ../llvm && \
make -j6 && \
make install"' && \
cd ../.. && \
rm -rf llvm-project

# Use just created devtools image with never GCC
FROM centos-devtoolset as libbpf

# Install libbpf - compile with a newer GCC. The one installed by default is not able to compile it.
# BUILD_STATIC_ONLY disables libbpf.so build as we don't need it.
ARG LIBBPF_VERSION
RUN mkdir -p /opt && cd /opt && \
curl -L https://github.com/gravitational/libbpf/archive/refs/tags/v${LIBBPF_VERSION}.tar.gz | tar xz && \
cd /opt/libbpf-${LIBBPF_VERSION}/src && \
scl enable devtoolset-11 "make && BUILD_STATIC_ONLY=y DESTDIR=/opt/libbpf make install"


FROM centos:7 AS buildbox

ENV LANGUAGE=en_US.UTF-8 \
Expand All @@ -143,10 +70,6 @@ RUN (groupadd ci --gid=$GID -o && useradd ci --uid=$UID --gid=$GID --create-home

RUN yum groupinstall -y 'Development Tools' && \
yum install -y \
# required by libbpf
elfutils-libelf-devel \
# required by libbpf
elfutils-libelf-devel-static \
git \
net-tools \
# required by Teleport PAM support
Expand All @@ -156,10 +79,6 @@ RUN yum groupinstall -y 'Development Tools' && \
# used by our Makefile
which \
zip \
# required by libbpf
zlib-devel \
# required by libbpf
zlib-static && \
yum clean all

# Install etcd.
Expand Down Expand Up @@ -243,13 +162,6 @@ RUN cd /usr/local/lib64 && \
COPY pkgconfig/centos7/ /
ENV PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig"

# Copy Clang into the final image.
COPY --from=clang10 /opt/llvm /opt/llvm/
ENV PATH=/opt/llvm/bin:${PATH}

# Copy libbpf into the final image.
COPY --from=libbpf /opt/libbpf/usr /usr

USER ci
VOLUME ["/go/src/github.com/gravitational/teleport"]
EXPOSE 6600 2379 2380