teleport/build.assets/Dockerfile-centos7-assets
Jakub Nyckowski e62ff82183
Unify x86/ARM64 build process (#21660)
* Unify x86/AMD64 build process

Currently, our ARM64 pipeline builds limited subset of Teleport features as none of the 3rd party dependencies (openssh, libbpf etc) are not built on AMR64. This change build all dependencies on AMR64 in the same way as we do on x86.

FIPS changes are not included as we do not support FIPS on ARM64.

* Apply suggestions from code review

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

---------

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2023-02-15 15:38:59 +00:00

72 lines
2.3 KiB
Plaintext

FROM centos:7 AS centos-devtoolset
ARG 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}-gcc* \
# required by libbpf
${DEVTOOLSET}-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
ARG DEVTOOLSET
# 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} '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 -j$(grep -c processor /proc/cpuinfo) && \
make install"' && \
cd ../.. && \
rm -rf llvm-project
# Create the final image with Clang only. We're using this Docker image as a tar.gz mainly
# because we want to keep our artifacts on GitHub, and GH doesn't support blobs, only Docker images.
FROM scratch AS buildbox-centos7-assets
# Copy Clang into the final image.
COPY --from=clang10 /opt/llvm /opt/llvm/