From: E. Scott Daniels Date: Tue, 12 Nov 2019 14:20:52 +0000 (-0500) Subject: Add CI to build both images X-Git-Tag: 1.0.1~10 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=0344ad34699e563dc2e45a74d6828210dad42159;p=ric-app%2Fmc.git Add CI to build both images This change adds the needed directory structure and config files under the ci directory to build both the mc-core and the mc_listener images. Changes are needed in the ci management repo to "activate" these, so this is part 1 which sets the stage for the multi-image build. Also added a brief README at the top level. Signed-off-by: E. Scott Daniels Change-Id: Ief76d4e1a8811d06464af0d5d158de27bf5b0221 Make core directory name under ci consistent with root source dir Change-Id: I797c0f6373dd12669a032e619a64dafc1322a401 Add correct tag for mc-core Signed-off-by: E. Scott Daniels Change-Id: I0087ced6c876c3b91ca74f1b6e13a909ab765d4d Add top level readme Signed-off-by: E. Scott Daniels Change-Id: I0c1eb11d26ab86f0bda1a84256587bc2da460d53 --- diff --git a/README b/README new file mode 100644 index 0000000..a2c8748 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ + +This repo contains source and documentation for the Management Campaign (MC) xAPP. + +The following is a list of important directories at the root level of +the repo and a brief description of each. + +mc-core +This is the source for the core MC application + +sidecars +The MC application currently uses at least one "sidecar" container to +listen for messages and to funnel them in. This directory contains +one subdirectory per sidecar application. + +ci +This is the continuous integration directory. Within the ci directory +are subdirectories for each docker image which is created to support +the application. + +docs +Project documentation in a form which can be scraped from the repo and pushed +to a "free standing" document hosting site. diff --git a/ci/Dockerfile b/ci/Dockerfile index 57e70a0..bd08320 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,5 +1,10 @@ # vim: ts=4 sw=4 noet: +### 2019 November 11th +### This file is deprecated and can be removed once the ci-managment repo has been +### changed to use the docker files in the subdiretories +### + # ------------------------------------------------------------------------------- # Copyright (c) 2018-2019 AT&T Intellectual Property. # diff --git a/ci/README b/ci/README index abe687b..96f4177 100644 --- a/ci/README +++ b/ci/README @@ -17,6 +17,26 @@ These files are needed to support the continuous integration process which verifies code on commit and might build images for the application. -The Docker file is used to build an image during CI vetting, and maybe even -during the building of the overall application container. For vetting, -the successful build indicates that all vetting of the repo passed. +There are multiple containers built from this repo. For each container built +there is a subdirectory here: + + listener -- the mc_listener application which ingests RMR messages to feed + the core MC xAPP. + + mc_core -- The core MC xAPP. + + +The builds are kicked off based on the yaml files in the ci-management project + ssh://@gerrit.o-ran-sc.org:29418/ci-management + +Specifically controlled by ric-app-mc.yaml. + + +Image Versioning +Docker image tags are applied based on the contents of the container-tag.yaml +file in each of the directories listed above. Specifically the "tag" field as +illustrated in the following example: + + tag: '1.2.1' + + diff --git a/ci/listener/Dockerfile b/ci/listener/Dockerfile new file mode 100644 index 0000000..38ecfca --- /dev/null +++ b/ci/listener/Dockerfile @@ -0,0 +1,76 @@ +# vim: ts=4 sw=4 noet: +#================================================================================== +# Copyright (c) 2018-2019 AT&T Intellectual Property. +# +# 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. +#================================================================================== + + +# Mnemonic: Dockerfile (listener) +# Abstract: Build file which creaes a runtime image for the listener. +# Building should be as simple as: +# +# docker build -f ci/listener/Dockerfile -t mc_listener:xx.xx . +# +# The build MUST be run from the repo root as it is impossible to +# reference the needed source from inside of this directory. +# +# Running the image in a container: +# The fifo output directory needs to be mounted to the container +# e.g. -v /exports/mcl/fifos:/tmp/mcl/fifos. The internal +# directory can be supplied on the command line using -d path, but +# should not be needed. +# +# The RMR listen port must be properly exposed to the container. The +# internal default is 4560, and can be changed with the -p port option +# on the command line (needed if running from docker-compose). Typical +# exposure might be -p :4560 on the docker run command. +# +# The MC listener application does NOT need route table updates and thus +# there is NO need to expose the route table generator port on this +# container. +# +# Date: 22 August 2019 +# Author: E. Scott Daniels + + +FROM ubuntu:18.04 as buildenv +RUN mkdir /playpen + +RUN apt-get update && apt-get install -y cmake gcc make git g++ wget + +RUN mkdir /playpen/bin /playpen/src +ARG SRC=sidecars/listener +COPY ${SRC}/build_dev_env.sh /playpen/bin/ +COPY ${SRC}/Makefile ${SRC}/*.h ${SRC}/*.c /playpen/src/ + +ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib +ENV C_INCLUDE_PATH=/usr/local/include +RUN bash /playpen/bin/build_dev_env.sh +RUN cd /playpen/src/; make -B mc_listener sender pipe_reader + +# ----- final, smaller image ---------------------------------- +FROM ubuntu:18.04 + +# obtusely this uses the previous value +ARG SRC + +RUN mkdir -p /playpen/bin +COPY --from=buildenv /usr/local/lib/* /usr/local/lib/ +COPY --from=buildenv /playpen/src/mc_listener /playpen/src/sender /playpen/src/pipe_reader /playpen/bin/ +COPY ${SRC}/verify.sh /playpen/bin + +ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib +ENV C_INCLUDE_PATH=/usr/local/include + +CMD [ "/playpen/bin/mc_listener" ] diff --git a/ci/listener/container-tag.yaml b/ci/listener/container-tag.yaml new file mode 100644 index 0000000..ae02c3b --- /dev/null +++ b/ci/listener/container-tag.yaml @@ -0,0 +1,2 @@ +--- +tag: '1.2.1' diff --git a/ci/mc-core/Dockerfile b/ci/mc-core/Dockerfile new file mode 100644 index 0000000..90fffc2 --- /dev/null +++ b/ci/mc-core/Dockerfile @@ -0,0 +1,95 @@ +# ------------------------------------------------------------------------------- +# Copyright (c) 2018-2019 AT&T Intellectual Property. +# +# 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. +# ------------------------------------------------------------------------------- + +# Mnemonic: Dockerfile (mc_core) +# Abstract: Build file which creaes a runtime image for the MC-xAPP core process. +# Building should be as simple as: +# +# docker build -f ci/mc_core/Dockerfile -t mcxapp . +# +# The build MUST be run from the repo root as it is impossible to +# reference the needed source from inside of this directory. +# + +ARG STAGE_DIR=/mc +ARG SRC=mc-core + +FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:2-u16.04-nng AS project-build +# Update & installation of linux packages +RUN apt-get update -y && \ + apt-get install -y curl && \ + apt-get install -y procps && \ + apt-get install -y python-pip + +ARG STAGE_DIR +ARG SRC + +COPY ${SRC}/mc ${STAGE_DIR} +WORKDIR ${STAGE_DIR} +RUN git clone https://github.com/protocolbuffers/protobuf.git +WORKDIR ${STAGE_DIR}/protobuf +RUN ./autogen.sh +RUN ./configure +RUN make clean +RUN make +RUN make install +RUN ldconfig +WORKDIR ${STAGE_DIR} +RUN git clone https://github.com/protobuf-c/protobuf-c.git +WORKDIR protobuf-c +RUN ./autogen.sh +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig +RUN ./configure +RUN make +RUN make install +RUN ldconfig +RUN pip install protobuf +WORKDIR ${STAGE_DIR} +RUN git clone https://gerrit.o-ran-sc.org/r/com/gs-lite +WORKDIR ${STAGE_DIR}/gs-lite +COPY ${SRC}/mc/cfg ${STAGE_DIR}/gs-lite/cfg +COPY ${SRC}/mc/local_datasource ${STAGE_DIR}/gs-lite/src/lib/gscprts/local_datasource +COPY ${SRC}/mc/local ${STAGE_DIR}/gs-lite/include/lfta/local +COPY ${SRC}/mc/queries ${STAGE_DIR}/gs-lite/demo/queries +RUN ./build_and_install.sh +WORKDIR ${STAGE_DIR}/gs-lite/demo/queries +ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite +RUN bash ${STAGE_DIR}/gs-lite/bin/buildit + + +# now install the binaries and libraries into smaller docker image +FROM ubuntu:16.04 + +ARG STAGE_DIR + +COPY --from=project-build ${STAGE_DIR}/gs-lite/demo/queries /mc/gs-lite/demo/queries +COPY --from=project-build ${STAGE_DIR}/gs-lite/bin /mc/gs-lite/bin +COPY --from=project-build ${STAGE_DIR}/data_gen /mc/data_gen +COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /mc/ +COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/ +COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/ + +RUN apt-get update && \ + apt-get install -y curl python python-pip && \ + apt-get clean + +RUN ldconfig +RUN pip install protobuf + +ENV XAPP_DESCRIPTOR_PATH /mc/mc_deployment.json +WORKDIR /mc/gs-lite/demo/queries +ENV GSLITE_ROOT /mc/gs-lite +CMD ["./runall"] diff --git a/ci/mc-core/container-tag.yaml b/ci/mc-core/container-tag.yaml new file mode 100644 index 0000000..b72de81 --- /dev/null +++ b/ci/mc-core/container-tag.yaml @@ -0,0 +1,2 @@ +--- +tag: '1.0.1'