forked from AliyunContainerService/terway
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.policy
55 lines (51 loc) · 2.72 KB
/
Dockerfile.policy
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
FROM --platform=$TARGETPLATFORM calico/go-build:v0.90 as felix-builder
ARG GOPROXY
ARG GIT_VERSION
ENV GOPROXY $GOPROXY
ENV GIT_BRANCH=v3.24.5
ENV GIT_COMMIT=f1a1611acb98d9187f48bbbe2227301aa69f0499
RUN mkdir -p /go/src/github.com/projectcalico/ && cd /go/src/github.com/projectcalico/ && \
git clone -b ${GIT_BRANCH} --depth 1 https://github.com/projectcalico/calico.git && \
cd calico && [ "`git rev-parse HEAD`" = "${GIT_COMMIT}" ]
COPY policy/felix /terway_patch
RUN cd /go/src/github.com/projectcalico/calico && git apply /terway_patch/*.patch
RUN cd /go/src/github.com/projectcalico/calico && \
CGO_ENABLED=0 go build -o bin/calico-felix -ldflags \
"-s -w -X github.com/projectcalico/calico/felix/buildinfo.GitVersion=${GIT_BRANCH} \
-X github.com/projectcalico/calico/felix/buildinfo.BuildDate=$(date -u +'%FT%T%z') \
-X github.com/projectcalico/calico/felix/buildinfo.GitRevision=${GIT_VERSION} \
-B 0x${GIT_VERSION}" "github.com/projectcalico/calico/felix/cmd/calico-felix" && \
( ! $(readelf -d bin/calico-felix | grep -q NEEDED) || ( echo "Error: bin/calico-felix was not statically linked"; false )) \
&& chmod +x /go/src/github.com/projectcalico/calico/bin/calico-felix
FROM --platform=$TARGETPLATFORM quay.io/cilium/cilium-builder:1d3ec0f0b74a32048a9716c7a8ce1eee851ca0ec@sha256:9fab9eb021456705d99b014d2f9e59aff9f50aa1a296aa55e984f3e947a62120 as cilium-builder
ARG GOPROXY
ENV GOPROXY $GOPROXY
ARG CILIUM_SHA=""
ARG GIT_VERSION=""
LABEL cilium-sha=${CILIUM_SHA}
LABEL maintainer="[email protected]"
WORKDIR /go/src/github.com/cilium
RUN rm -rf cilium
ENV GIT_TAG=v1.12.7
ENV GIT_COMMIT=67190636f1d5a7a443ea0bda585b215e7650dd25
RUN git clone -b $GIT_TAG --depth 1 https://github.com/cilium/cilium.git && \
cd cilium && git config --global user.email terway && git config --global user.name terway && \
[ "`git rev-parse HEAD`" = "${GIT_COMMIT}" ]
COPY policy/cilium /cilium_patch
RUN cd cilium && git am /cilium_patch/*.patch
ARG NOSTRIP
ARG LOCKDEBUG
ARG V
ARG LIBNETWORK_PLUGIN
#
# Please do not add any dependency updates before the 'make install' here,
# as that will mess with caching for incremental builds!
#
RUN cd cilium && make NOSTRIP=$NOSTRIP LOCKDEBUG=$LOCKDEBUG PKG_BUILD=1 GIT_VERSION=${GIT_VERSION} V=$V LIBNETWORK_PLUGIN=$LIBNETWORK_PLUGIN \
SKIP_DOCS=true DESTDIR=/tmp/install clean-container build-container install-container
RUN cp /tmp/install/opt/cni/bin/cilium-cni /tmp/install/usr/bin/
RUN cd /go/src/github.com/cilium/cilium/operator && make cilium-operator-generic \
&& mv cilium-operator-generic /tmp/install/usr/bin/
FROM scratch
COPY --from=felix-builder /go/src/github.com/projectcalico/calico/bin/calico-felix /bin/calico-felix
COPY --from=cilium-builder /tmp/install/ /tmp/install/