Skip to content

Commit

Permalink
Add GoBGP client binary to antrea agent image
Browse files Browse the repository at this point in the history
Signed-off-by: Rajnish Kumar <[email protected]>
  • Loading branch information
rajnkamr committed Aug 30, 2024
1 parent 29f947c commit f277f0b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
26 changes: 26 additions & 0 deletions build/images/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,31 @@
# limitations under the License.

ARG BUILD_TAG

FROM ubuntu:22.04 AS gobgp-binary

RUN apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates golang

ENV PATH=$PATH:/usr/local/go/bin

WORKDIR /tmp/gobgp

RUN go mod init temp-gobgp && \
go get github.com/osrg/gobgp/v3

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) pluginsArch='amd64' ;; \
armhf) pluginsArch='arm' ;; \
arm64) pluginsArch='arm64' ;; \
*) pluginsArch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \
esac; \
mkdir -p /opt/bgp; \
bgp_version="$(go list -m all | grep github.com/osrg/gobgp/v3 | cut -d " " -f2 | cut -c 2-)"; \
wget -q -O - https://github.com/osrg/gobgp/releases/download/v$bgp_version/gobgp_${bgp_version}_linux_${pluginsArch}.tar.gz | tar xz -C /opt/bgp

FROM ubuntu:22.04 AS cni-binaries

ARG CNI_BINARIES_VERSION
Expand Down Expand Up @@ -57,3 +82,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends ipset jq inotif
/iptables-wrapper-installer.sh

COPY --from=cni-binaries /opt/cni/bin /opt/cni/bin
COPY --from=gobgp-binary /opt/bgp/gobgp /opt/bgp/gobgp
26 changes: 26 additions & 0 deletions build/images/base/Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,31 @@
# limitations under the License.

ARG BUILD_TAG

FROM ubuntu:22.04 AS gobgp-binary

RUN apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates golang

ENV PATH=$PATH:/usr/local/go/bin

WORKDIR /tmp/gobgp

RUN go mod init temp-gobgp && \
go get github.com/osrg/gobgp/v3

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) pluginsArch='amd64' ;; \
armhf) pluginsArch='arm' ;; \
arm64) pluginsArch='arm64' ;; \
*) pluginsArch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \
esac; \
mkdir -p /opt/bgp; \
bgp_version="$(go list -m all | grep github.com/osrg/gobgp/v3 | cut -d " " -f2 | cut -c 2-)"; \
wget -q -O - https://github.com/osrg/gobgp/releases/download/v$bgp_version/gobgp_${bgp_version}_linux_${pluginsArch}.tar.gz | tar xz -C /opt/bgp

FROM ubuntu:22.04 AS cni-binaries

ARG CNI_BINARIES_VERSION
Expand Down Expand Up @@ -50,3 +75,4 @@ RUN yum install ipset jq yum-plugin-copr -y && \
yum remove yum-plugin-copr -y && yum clean all

COPY --from=cni-binaries /opt/cni/bin /opt/cni/bin
COPY --from=gobgp-binary /opt/bgp/gobgp /opt/bgp/gobgp
1 change: 0 additions & 1 deletion build/images/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ function docker_build_and_push() {
local image="$1"
local dockerfile="$2"
local build_args="--build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg SURICATA_VERSION=$SURICATA_VERSION --build-arg BUILD_TAG=$BUILD_TAG"
local cache_args=""
if $PUSH; then
cache_args="$cache_args --cache-to type=registry,ref=$image-cache:$BUILD_CACHE_TAG,mode=max"
fi
Expand Down

0 comments on commit f277f0b

Please sign in to comment.