From 93b9c98c441ab571d1493488ab8e54115f9a04d5 Mon Sep 17 00:00:00 2001 From: Andrej Kozemcak Date: Fri, 18 Jan 2019 09:08:28 +0100 Subject: Create docker enviroment. Change-Id: I9ead8f2517f3f461bf3fe629804b8966783eecbd Signed-off-by: Andrej Kozemcak --- Makefile | 4 + build-root/scripts/de_build.sh | 30 ++++++++ build-root/scripts/docker.sh | 58 +++++++++++++++ src/Docker/Build/Dockerfile | 163 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100755 build-root/scripts/de_build.sh create mode 100755 build-root/scripts/docker.sh create mode 100644 src/Docker/Build/Dockerfile diff --git a/Makefile b/Makefile index c2814b5..71b086a 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ help: @echo " build-scvpp - build scvpp" @echo " build-plugins - build plugins" @echo " build-package - build rpm or deb package" + @echo " docker - build sweetcomb in docker enviroment" @echo " clean - clean all build" @echo " distclean - remove all build directory" $(BR)/.deps.ok: @@ -199,6 +200,9 @@ build-scvpp: build-plugins: @mkdir -p $(BR)/build-plugins/;cd $(BR)/build-plugins/;cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/src/plugins/;make install; +docker: + @build-root/scripts/docker.sh + build-package: @mkdir -p $(BR)/build-scvpp/;cd $(BR)/build-scvpp;cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/src/scvpp/;make install; @mkdir -p $(BR)/build-package/;cd $(BR)/build-package/;$(cmake) $(WS_ROOT)/src/;make package;rm -rf $(BR)/build-package/_CPack_Packages; diff --git a/build-root/scripts/de_build.sh b/build-root/scripts/de_build.sh new file mode 100755 index 0000000..812cdcb --- /dev/null +++ b/build-root/scripts/de_build.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright (c) 2019 PANTHEON.tech. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SWEETCOMB_DIR="/root/src/sweetcomb" + +function build_sweetcomb { + cd /root/src/sweetcomb + yes | make install-dep + make build-scvpp + make build +} + +function main { + build_sweetcomb +} + +main $@ diff --git a/build-root/scripts/docker.sh b/build-root/scripts/docker.sh new file mode 100755 index 0000000..8ed872e --- /dev/null +++ b/build-root/scripts/docker.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Copyright (c) 2019 PANTHEON.tech. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +IMAGE="sweetcomb_img" +CONTAINER="sweetcomb" + +function build_enviroment { + FIND=`docker images | grep ${IMAGE}` + + if [ -n "${FIND}" ]; then + return + fi + + docker build -t ${IMAGE} ./src/Docker/Build +} + +function create_container { + docker run -id --privileged --name ${CONTAINER} \ + -v $(pwd)/../sweetcomb:/root/src/sweetcomb ${IMAGE} +} + +function start_container { + FIND=`docker container ls -a | grep ${CONTAINER}` + + if [ -z "${FIND}" ]; then + create_container + else + FIND=`docker container ps | grep ${CONTAINER}` + if [ -z "${FIND}" ]; then + docker start ${CONTAINER} + fi + fi +} + +function build_sweetcomb { + docker exec -it ${CONTAINER} bash -c "/root/src/sweetcomb/build-root/scripts/de_build.sh" +} + +function main { + build_enviroment + start_container + build_sweetcomb +} + +main $@ diff --git a/src/Docker/Build/Dockerfile b/src/Docker/Build/Dockerfile new file mode 100644 index 0000000..4d4ad04 --- /dev/null +++ b/src/Docker/Build/Dockerfile @@ -0,0 +1,163 @@ + +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y cmake make gcc git sudo autoconf \ + libtool libpugixml-dev libjsoncpp-dev screen inetutils-ping iproute2 \ + command-not-found net-tools traceroute ethtool + +RUN mkdir -p /usr/local/src + +#=============================================================================== +# VPP +#=============================================================================== + +WORKDIR /usr/local/src + +RUN git clone https://gerrit.fd.io/r/vpp + +WORKDIR /usr/local/src/vpp + +RUN git checkout tags/v19.04-rc0 + +RUN yes | make install-dep + +RUN make build + +RUN make pkg-deb + +WORKDIR /usr/local/src/vpp/build-root + +RUN dpkg -i vpp-lib_*.deb vpp_*.deb vpp-dev_*.deb \ + vpp-plugins_*.deb vpp-dbg*.deb + +#=============================================================================== +# Protobuf +#=============================================================================== + +WORKDIR /usr/local/src + +RUN git clone https://github.com/google/protobuf.git + +WORKDIR /usr/local/src/protobuf + +RUN git checkout tags/v3.6.1 + +RUN ./autogen.sh && ./configure --prefix=/usr && make && make install + +RUN ldconfig + +#=============================================================================== +# Cmocka +#=============================================================================== + +WORKDIR /usr/local/src + +RUN apt-get install -y git cmake build-essential bison flex libpcre3-dev libev-dev\ + libavl-dev valgrind python-dev lua5.2 + +RUN git clone git://git.cryptomilk.org/projects/cmocka.git + +RUN mkdir -p ./cmocka/build + +WORKDIR /usr/local/src/cmocka/build + +RUN git checkout tags/cmocka-1.1.3 + +RUN cmake -DCMAKE_BUILD_TYPE=Debug .. && make && make install + +#=============================================================================== +# Libyang +#=============================================================================== + +WORKDIR /usr/local/src + +RUN apt-get install -y libpcre3-dev + +RUN git clone https://github.com/CESNET/libyang.git + +RUN mkdir -p ./libyang/build + +WORKDIR /usr/local/src/libyang/build + +RUN git checkout tags/v0.16-r2 + +RUN cmake .. && make && make install + +#=============================================================================== +# Sysrepo +#=============================================================================== + +WORKDIR /usr/local/src + +RUN apt-get install -y liblua5.1-0-dev protobuf-c-compiler libprotobuf-c-dev + +RUN git clone https://github.com/sysrepo/sysrepo.git + +RUN mkdir -p sysrepo/build + +WORKDIR /usr/local/src/sysrepo/build + +RUN git checkout tags/v0.7.6 + +RUN cmake -DCMAKE_BUILD_TYPE=Debug -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install + +RUN ldconfig + +#=============================================================================== +# Libnetconf2 +#=============================================================================== + +WORKDIR /usr/local/src + +RUN apt-get install -y libssh-dev + +RUN git clone https://github.com/CESNET/libnetconf2.git + +RUN mkdir -p libnetconf2/build + +WORKDIR /usr/local/src/libnetconf2/build + +RUN git checkout tags/v0.12-r1 + +RUN cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ + +RUN make && make install && ldconfig + +#=============================================================================== +# Netopeer2 +#=============================================================================== + +WORKDIR /usr/local/src + +RUN git clone https://github.com/CESNET/Netopeer2.git + +WORKDIR /usr/local/src/Netopeer2 + +RUN git checkout tags/v0.7-r1 + +RUN mkdir -p ./keystored/build && mkdir -p ./cli/build && mkdir -p ./server/build + +WORKDIR /usr/local/src/Netopeer2/keystored/build + +RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ + +RUN make && make install && ldconfig + +WORKDIR /usr/local/src/Netopeer2/server/build + +RUN cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ + +RUN make && make install && ldconfig + +WORKDIR /usr/local/src/Netopeer2/cli/build + +RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ + +RUN make && make install && ldconfig + +#=============================================================================== +# End +#=============================================================================== + +WORKDIR /root/src + -- cgit 1.2.3-korg