forked from cilium/proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.builder
71 lines (69 loc) · 2.26 KB
/
Dockerfile.builder
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
#
# Builder dependencies. This takes a long time to build from scratch!
# Also note that if build fails due to C++ internal error or similar,
# it is possible that the image build needs more RAM than available by
# default on non-Linux docker installs.
#
# Using Ubuntu 18.04 as base, as building with 20.04 will result in a
# cilium-envoy binary that fails to run on 18.04 due to the glibc
# being 2.27, while 2.28 and/or 2.29 is required. This will also
# affect Istio sidecar compatibility, so we should keep the builder at
# Ubuntu 18.04 for now.
FROM docker.io/library/ubuntu:18.04 as base
LABEL maintainer="[email protected]"
ARG TARGETARCH
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends && \
# Only install cross tools on amd64
CROSSPKG="" && [ "$TARGETARCH" != "amd64" ] || CROSSPKG="gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross binutils-aarch64-linux-gnu" && \
apt-get install -y --no-install-recommends \
# Multi-arch cross-compilation packages
$CROSSPKG \
# Envoy Build dependencies
autoconf \
automake \
clang-10 \
cmake \
coreutils \
curl \
g++ \
gcc \
git \
libc6-dev \
libtool \
lld-10 \
llvm-10-dev \
make \
ninja-build \
patch \
python \
python3 \
unzip \
virtualenv \
wget \
zip && \
apt-get purge --auto-remove && \
apt-get clean && \
ln /usr/bin/clang-10 /usr/bin/clang && ln /usr/bin/clang++-10 /usr/bin/clang++ && ln /usr/bin/lld-10 /usr/bin/lld && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /cilium/proxy
COPY .bazelversion ./
#
# Install Bazel
#
RUN export BAZEL_VERSION=$(cat .bazelversion) \
&& ARCH=$TARGETARCH && [ "$ARCH" != "amd64" ] || ARCH="x86_64" \
&& curl -sfL https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${ARCH} -o /usr/bin/bazel \
&& chmod +x /usr/bin/bazel
#
# Install GN (https://gn.googlesource.com/gn/) for arm64
#
RUN if [ "$TARGETARCH" = "arm64" ]; then \
git clone https://gn.googlesource.com/gn \
&& cd gn \
&& python build/gen.py \
&& ninja -C out \
&& install -m 0755 out/gn /usr/bin \
&& cd .. \
&& rm -rf gn /tmp/* /var/tmp/*; \
fi