@@ -3,24 +3,54 @@ ARG TAG="v3.7.1"
33ARG UBI_IMAGE=registry.access.redhat.com/ubi7/ubi-minimal:latest
44ARG GO_IMAGE=rancher/hardened-build-base:v1.15.8b5
55
6- # Build the project
6+ # Build the multus project
77FROM ${GO_IMAGE} as builder
88RUN set -x \
99 && apk --no-cache add \
10- git
10+ patch
1111ARG ARCH
1212ARG TAG
1313ENV GOARCH ${ARCH}
1414ENV 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
2049
2150# Create the multus image
2251FROM ${UBI_IMAGE}
2352COPY --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/
2454WORKDIR /
2555RUN cp /usr/src/multus-cni/images/entrypoint.sh /entrypoint.sh
2656ENTRYPOINT ["entrypoint.sh" ]
0 commit comments