diff options
author | Lou Berger <lberger@labn.net> | 2021-03-28 13:44:16 +0200 |
---|---|---|
committer | Lou Berger <lberger@labn.net> | 2021-04-12 22:56:38 +0200 |
commit | 60bad451a5ab94df06f12dd4b8f3a30d7dc223de (patch) | |
tree | 4f2e1cf50710a651c6daa738b53083ab0262ded4 /docker | |
parent | ubuntu18-ci: create a docker 18.04 container for dev / test / ci (diff) | |
download | frr-60bad451a5ab94df06f12dd4b8f3a30d7dc223de.tar.xz frr-60bad451a5ab94df06f12dd4b8f3a30d7dc223de.zip |
ubuntu20-ci: create a docker 20.04 container for dev / test / ci
Signed-off-by: Lou Berger <lberger@labn.net>
Diffstat (limited to 'docker')
-rw-r--r-- | docker/ubuntu20-ci/Dockerfile | 74 | ||||
-rw-r--r-- | docker/ubuntu20-ci/README.md | 45 | ||||
-rwxr-xr-x | docker/ubuntu20-ci/docker-start | 8 |
3 files changed, 127 insertions, 0 deletions
diff --git a/docker/ubuntu20-ci/Dockerfile b/docker/ubuntu20-ci/Dockerfile new file mode 100644 index 000000000..56657789e --- /dev/null +++ b/docker/ubuntu20-ci/Dockerfile @@ -0,0 +1,74 @@ +FROM ubuntu:20.04 + +ARG DEBIAN_FRONTEND=noninteractive +ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn +# Update Ubuntu Software repository +RUN apt update && \ + apt-get install -y \ + git autoconf automake libtool make libreadline-dev texinfo \ + pkg-config libpam0g-dev libjson-c-dev bison flex python3-pytest \ + libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \ + install-info build-essential libsystemd-dev libsnmp-dev perl \ + libcap-dev python2 libelf-dev \ + sudo gdb curl iputils-ping time \ + mininet iproute2 iperf && \ + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py && \ + python2 /tmp/get-pip.py && \ + rm -f /tmp/get-pip.py && \ + pip2 install ipaddr && \ + pip2 install "pytest<5" && \ + pip2 install "scapy>=2.4.2" && \ + pip2 install exabgp==3.4.17 + +RUN groupadd -r -g 92 frr && \ + groupadd -r -g 85 frrvty && \ + adduser --system --ingroup frr --home /home/frr \ + --gecos "FRR suite" --shell /bin/bash frr && \ + usermod -a -G frrvty frr && \ + useradd -d /var/run/exabgp/ -s /bin/false exabgp && \ + echo 'frr ALL = NOPASSWD: ALL' | tee /etc/sudoers.d/frr && \ + mkdir -p /home/frr && chown frr.frr /home/frr + +#for libyang 1 +RUN apt-get install -y cmake libpcre3-dev + +USER frr:frr + +# build and install libyang1 +RUN cd && pwd && ls -al && \ + git clone https://github.com/CESNET/libyang.git && \ + cd libyang && \ + git checkout v1.0.225 && \ + mkdir build; cd build && \ + cmake -DENABLE_LYD_PRIV=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr \ + -D CMAKE_BUILD_TYPE:String="Release" .. && \ + make -j $(nproc) && \ + sudo make install + +COPY --chown=frr:frr . /home/frr/frr/ + +RUN cd && ls -al && ls -al frr + +RUN cd ~/frr && \ + ./bootstrap.sh && \ + ./configure \ + --prefix=/usr \ + --localstatedir=/var/run/frr \ + --sbindir=/usr/lib/frr \ + --sysconfdir=/etc/frr \ + --enable-vtysh \ + --enable-pimd \ + --enable-sharpd \ + --enable-multipath=64 \ + --enable-user=frr \ + --enable-group=frr \ + --enable-vty-group=frrvty \ + --enable-snmp=agentx \ + --with-pkg-extra-version=-my-manual-build && \ + make -j $(nproc) && \ + sudo make install + +RUN cd ~/frr && make check || true + +COPY docker/ubuntu20-ci/docker-start /usr/sbin/docker-start +ENTRYPOINT ["/usr/sbin/docker-start"] diff --git a/docker/ubuntu20-ci/README.md b/docker/ubuntu20-ci/README.md new file mode 100644 index 000000000..11138c650 --- /dev/null +++ b/docker/ubuntu20-ci/README.md @@ -0,0 +1,45 @@ +# Ubuntu 20.04 + +This builds an ubuntu 20.04 container for dev / test + +# Build + +``` +docker build -t frr-ubuntu20:latest -f docker/ubuntu20-ci/Dockerfile . +``` + +# Running + +``` +docker run -d --privileged --name frr-ubuntu20 --mount type=bind,source=/lib/modules,target=/lib/modules frr-ubuntu20:latest +``` + +# make check + +``` +docker exec frr-ubuntu20 bash -c 'cd ~/frr ; make check' +``` + +# interactive bash + +``` +docker exec -it frr-ubuntu20 bash +``` + +# topotest -- when Host O/S is Ubuntu only + +``` +docker exec frr-ubuntu20 bash -c 'cd ~/frr/tests/topotests/ospf-topo1 ; sudo pytest test_ospf_topo1.py' +``` + +# stop & remove container + +``` +docker stop frr-ubuntu20 ; docker rm frr-ubuntu18 +``` + +# remove image + +``` +docker rmi frr-ubuntu20:latest +``` diff --git a/docker/ubuntu20-ci/docker-start b/docker/ubuntu20-ci/docker-start new file mode 100755 index 000000000..9a45c722f --- /dev/null +++ b/docker/ubuntu20-ci/docker-start @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ $(uname -a | grep -ci Ubuntu) -ge 1 ]; then + #for topotests under ubuntu host + sudo modprobe mpls-router mpls-iptunnel + sudo /etc/init.d/openvswitch-switch start +fi +while true ; do sleep 365d ; done |