forked from containernetworking/plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: yanjianbo <[email protected]>
- Loading branch information
1 parent
fa48f75
commit 888dc87
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.17.13 as builder | ||
ARG pluginVersion=v0.9.1 | ||
COPY . /plugins | ||
RUN cd /plugins && \ | ||
bash build_linux.sh -ldflags "-extldflags -static -X 'github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${pluginVersion}'" | ||
|
||
FROM alpine:3.15 | ||
|
||
RUN mkdir -p /plugins/bin | ||
COPY --from=builder /plugins/bin/bridge \ | ||
/plugins/bin/host-local \ | ||
/plugins/bin/loopback \ | ||
/plugins/bin/portmap \ | ||
/plugins/bin/bandwidth \ | ||
/plugins/bin/ | ||
COPY --from=builder /plugins/scripts/env_prepare.sh /plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
VERSION=${1:-latest} | ||
|
||
if [[ $(docker buildx ls) != *"mybuilder"* ]]; then | ||
docker buildx create --name mybuilder --bootstrap --use | ||
fi | ||
docker buildx use mybuilder | ||
|
||
docker buildx build \ | ||
--build-arg="pluginVersion=${VERSION}" \ | ||
--platform linux/amd64,linux/arm64,linux/arm/v7 \ | ||
--push \ | ||
-t fabedge/cni-plugins:${VERSION} . | ||
|
||
docker buildx use default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
|
||
# install CNI plugins | ||
find /etc/cni/net.d/ -type f -not -name fabedge.conflist -exec rm {} \; | ||
cp -f /plugins/bin/bridge \ | ||
/plugins/bin/host-local \ | ||
/plugins/bin/loopback \ | ||
/plugins/bin/portmap \ | ||
/plugins/bin/bandwidth /opt/cni/bin | ||
|
||
# cleanup flannel stuff | ||
ip link delete cni0 | ||
ip link delete flannel.1 | ||
ip route | grep "flannel" | while read dst via gw others; do ip route delete $dst via $gw; done | ||
iptables -t nat -F POSTROUTING | ||
|
||
exit 0 |