Fix: update the correct pre-built script to cmake-sonar.sh
[ric-app/mc.git] / mc-core / Dockerfile
1 # -------------------------------------------------------------------------------
2 #    Copyright (c) 2018-2019 AT&T Intellectual Property.
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15 # -------------------------------------------------------------------------------
16
17 ARG STAGE_DIR=/mc
18
19 # builders are now in release (10002)
20 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 AS project-build
21
22 ARG STAGE_DIR
23
24 ARG RMR_VER=4.7.4
25 ARG RMR_PC_REPO=release
26 #ARG RMR_PC_REPO=staging
27 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/${RMR_PC_REPO}/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
28 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/${RMR_PC_REPO}/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
29 RUN dpkg -i rmr_${RMR_VER}_amd64.deb
30 RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
31 RUN ldconfig
32
33 COPY mc ${STAGE_DIR}
34 WORKDIR ${STAGE_DIR}
35 RUN apt-get update && \
36         apt-get install -y libboost-all-dev && \
37         apt-get install -y libhiredis-dev && \
38         apt-get clean
39 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
40 WORKDIR ${STAGE_DIR}/sdl
41 RUN ./autogen.sh
42 RUN ./configure
43 RUN make all
44 RUN make install
45 WORKDIR ${STAGE_DIR}
46 RUN git clone https://github.com/protocolbuffers/protobuf.git
47 WORKDIR ${STAGE_DIR}/protobuf
48 RUN ./autogen.sh
49 RUN ./configure
50 RUN make clean
51 RUN make
52 RUN make install
53 RUN ldconfig
54
55 # hack to get protobufs to build
56 RUN cp src/google/protobuf/stubs/int128.h /usr/local/include/google/protobuf/stubs
57
58 WORKDIR ${STAGE_DIR}
59 RUN git clone https://github.com/protobuf-c/protobuf-c.git
60 WORKDIR protobuf-c
61 RUN ./autogen.sh
62 ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
63 RUN ./configure
64 RUN make
65 RUN make install
66 RUN ldconfig
67 WORKDIR ${STAGE_DIR}
68 RUN git clone -b release/0.3.0 https://gerrit.o-ran-sc.org/r/com/gs-lite
69 WORKDIR ${STAGE_DIR}/gs-lite
70 COPY mc/cfg/packet_schema.txt ${STAGE_DIR}/gs-lite/cfg/
71 COPY mc/cfg/ifres.xml ${STAGE_DIR}/gs-lite/cfg/
72 COPY mc/cfg/localhost.ifq ${STAGE_DIR}/gs-lite/cfg/
73 COPY mc/local_datasource ${STAGE_DIR}/gs-lite/src/lib/gscprts/local_datasource
74 COPY mc/local ${STAGE_DIR}/gs-lite/include/lfta/local
75 COPY mc/queries ${STAGE_DIR}/gs-lite/demo/queries
76 COPY mc/mcnib/* ${STAGE_DIR}/gs-lite/src/tools/
77 RUN ./build_and_install.sh
78 WORKDIR ${STAGE_DIR}/gs-lite/demo/queries
79 ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite
80 RUN bash ${STAGE_DIR}/gs-lite/bin/buildit
81 RUN python generate_runall.py
82
83
84 # now install the binaries and libraries into smaller docker image
85 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/ric-app-mc-listener:1.12.0
86
87 # keep this close to the top to prevent lengthy rebuilds during testing
88 RUN apt-get update && \
89     apt-get install -y curl python python-pip libboost-all-dev libhiredis-dev && \
90     apt-get clean
91
92 ARG STAGE_DIR
93
94 COPY --from=project-build ${STAGE_DIR}/gs-lite/demo/queries /mc/gs-lite/demo/queries
95 COPY --from=project-build ${STAGE_DIR}/gs-lite/bin /mc/gs-lite/bin
96 COPY --from=project-build ${STAGE_DIR}/data_gen /mc/data_gen
97 COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/
98 COPY --from=project-build ${STAGE_DIR}/extract_rmr_port.py /mc/
99 COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/
100 COPY --from=project-build /usr/local/lib/libsdl* /usr/local/lib/
101
102 WORKDIR /opt/ric/config
103 COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /opt/ric/config/config-file.json
104
105 COPY container_start.sh /playpen/bin/
106 COPY package/*.py package/*.sh /playpen/bin/
107
108 RUN ldconfig
109 RUN pip install protobuf
110
111 ENV XAPP_DESCRIPTOR_PATH /opt/ric/config/
112 WORKDIR /playpen
113 ENV GSLITE_ROOT /mc/gs-lite
114
115 CMD ["/playpen/bin/container_start.sh"]