forked from gravitational/teleport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-centos7-assets
71 lines (64 loc) · 2.34 KB
/
Dockerfile-centos7-assets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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/