diff --git a/build/images/base/Dockerfile b/build/images/base/Dockerfile index 9f10ebddc0c..6563b7c12d3 100644 --- a/build/images/base/Dockerfile +++ b/build/images/base/Dockerfile @@ -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 @@ -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 diff --git a/build/images/base/Dockerfile.ubi b/build/images/base/Dockerfile.ubi index 0c101c89bbd..fe920a7abbe 100644 --- a/build/images/base/Dockerfile.ubi +++ b/build/images/base/Dockerfile.ubi @@ -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 @@ -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 diff --git a/build/images/base/build.sh b/build/images/base/build.sh index 10ed579e0f1..5381ec112c0 100755 --- a/build/images/base/build.sh +++ b/build/images/base/build.sh @@ -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