Fix DBAAS configuration and increment mc-core container tag
[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 FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:4-u18.04-nng AS project-build
20 # Update & installation of linux packages
21 RUN apt-get update -y && \
22         apt-get install -y curl && \
23         apt-get install -y procps && \
24         apt-get install -y python-pip
25
26 ARG STAGE_DIR
27
28 COPY mc ${STAGE_DIR}
29 WORKDIR ${STAGE_DIR}
30 RUN apt-get install -y libboost-all-dev
31 RUN apt-get install -y libhiredis-dev
32 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
33 WORKDIR ${STAGE_DIR}/sdl
34 RUN ./autogen.sh
35 RUN ./configure
36 RUN make all
37 RUN make install
38 WORKDIR ${STAGE_DIR}
39 RUN git clone https://github.com/protocolbuffers/protobuf.git
40 WORKDIR ${STAGE_DIR}/protobuf
41 RUN ./autogen.sh
42 RUN ./configure
43 RUN make clean
44 RUN make
45 RUN make install
46 RUN ldconfig
47 WORKDIR ${STAGE_DIR}
48 RUN git clone https://github.com/protobuf-c/protobuf-c.git
49 WORKDIR protobuf-c
50 RUN ./autogen.sh
51 ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
52 RUN ./configure
53 RUN make
54 RUN make install
55 RUN ldconfig
56 RUN pip install protobuf
57 WORKDIR ${STAGE_DIR}
58 RUN git clone -b release/0.1.0 https://gerrit.o-ran-sc.org/r/com/gs-lite
59 WORKDIR ${STAGE_DIR}/gs-lite
60 COPY mc/cfg ${STAGE_DIR}/gs-lite/cfg
61 COPY mc/local_datasource ${STAGE_DIR}/gs-lite/src/lib/gscprts/local_datasource
62 COPY mc/local ${STAGE_DIR}/gs-lite/include/lfta/local
63 COPY mc/queries ${STAGE_DIR}/gs-lite/demo/queries
64 COPY mc/mcnib/* ${STAGE_DIR}/gs-lite/src/tools/
65 RUN ./build_and_install.sh
66 WORKDIR ${STAGE_DIR}/gs-lite/demo/queries
67 ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite
68 RUN bash ${STAGE_DIR}/gs-lite/bin/buildit
69 RUN python generate_runall.py
70
71
72 # now install the binaries and libraries into smaller docker image
73 FROM nexus3.o-ran-sc.org:10004/o-ran-sc/ric-app-mc-listener:1.3.3
74
75 ARG STAGE_DIR
76
77 COPY --from=project-build ${STAGE_DIR}/gs-lite/demo/queries /mc/gs-lite/demo/queries
78 COPY --from=project-build ${STAGE_DIR}/gs-lite/bin /mc/gs-lite/bin
79 COPY --from=project-build ${STAGE_DIR}/data_gen /mc/data_gen
80 COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/
81 COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/
82 COPY --from=project-build /usr/local/lib/libsdl* /usr/local/lib/
83
84 WORKDIR /opt/ric/config
85 COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /opt/ric/config
86
87 COPY container_start.sh /playpen/bin/
88
89 RUN apt-get update && \
90     apt-get install -y curl python python-pip libboost-all-dev libhiredis-dev \
91  redis-tools && \
92     apt-get clean
93
94 RUN ldconfig
95 RUN pip install protobuf
96
97 ENV XAPP_DESCRIPTOR_PATH /opt/ric/config/mc_deployment.json
98 WORKDIR /playpen
99 ENV GSLITE_ROOT /mc/gs-lite
100
101 CMD ["/playpen/bin/container_start.sh"]