@@ -3,24 +3,54 @@ ARG TAG="v3.7.1"
3
3
ARG UBI_IMAGE=registry.access.redhat.com/ubi7/ubi-minimal:latest
4
4
ARG GO_IMAGE=rancher/hardened-build-base:v1.15.8b5
5
5
6
- # Build the project
6
+ # Build the multus project
7
7
FROM ${GO_IMAGE} as builder
8
8
RUN set -x \
9
9
&& apk --no-cache add \
10
- git
10
+ patch
11
11
ARG ARCH
12
12
ARG TAG
13
13
ENV GOARCH ${ARCH}
14
14
ENV GOOS "linux"
15
- RUN git clone --depth=1 https://github.com/k8snetworkplumbingwg/multus-cni
16
- WORKDIR multus-cni
17
- RUN git fetch --all --tags --prune
18
- RUN git checkout tags/${TAG} -b ${TAG}
19
- RUN ./hack/build-go.sh
15
+ COPY 0001-Add-all-important-multus-binaries.patch .
16
+ RUN git clone --depth=1 https://github.com/k8snetworkplumbingwg/multus-cni \
17
+ && cd multus-cni \
18
+ && git fetch --all --tags --prune \
19
+ && git checkout tags/${TAG} -b ${TAG} \
20
+ && patch -p1 < ../0001-Add-all-important-multus-binaries.patch \
21
+ && ./hack/build-go.sh
22
+
23
+ # ## Build the CNI plugins ###
24
+ FROM ${GO_IMAGE} as cni_plugins
25
+ ARG TAG
26
+ ARG CNI_PLUGINS_VERSION="v0.9.1"
27
+ RUN git clone --depth=1 https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins \
28
+ && cd $GOPATH/src/github.com/containernetworking/plugins \
29
+ && git fetch --all --tags --prune \
30
+ && git checkout tags/${CNI_PLUGINS_VERSION} -b ${CNI_PLUGINS_VERSION} \
31
+ && sh -ex ./build_linux.sh -v \
32
+ -gcflags=-trimpath=/go/src \
33
+ -ldflags " \
34
+ -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${CNI_PLUGINS_VERSION} \
35
+ -linkmode=external -extldflags \" -static -Wl,--fatal-warnings\" \
36
+ "
37
+ WORKDIR $GOPATH/src/github.com/containernetworking/plugins
38
+ RUN go-assert-static.sh bin/* \
39
+ && go-assert-boring.sh \
40
+ bin/bridge \
41
+ bin/dhcp \
42
+ bin/host-device \
43
+ bin/host-local \
44
+ bin/ipvlan \
45
+ bin/macvlan \
46
+ bin/ptp \
47
+ && mkdir -vp /opt/cni/bin \
48
+ && install -D -s bin/* /opt/cni/bin
20
49
21
50
# Create the multus image
22
51
FROM ${UBI_IMAGE}
23
52
COPY --from=builder /go/multus-cni /usr/src/multus-cni
53
+ COPY --from=cni_plugins /opt/cni/bin/bridge /opt/cni/bin/dhcp /opt/cni/bin/host-device /opt/cni/bin/host-local /opt/cni/bin/ipvlan /opt/cni/bin/macvlan /opt/cni/bin/ptp /opt/cni/bin/static /opt/cni/bin/tuning /opt/cni/bin/
24
54
WORKDIR /
25
55
RUN cp /usr/src/multus-cni/images/entrypoint.sh /entrypoint.sh
26
56
ENTRYPOINT ["entrypoint.sh" ]
0 commit comments