Bundle the listener into the core image
[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-ubuntu16-c-go:3-u16.04-nng AS project-build
20
21 # Update & installation of linux packages
22 RUN apt-get update -y && \
23         apt-get install -y curl && \
24         apt-get install -y procps && \
25         apt-get install -y python-pip
26
27 ARG STAGE_DIR
28
29 COPY mc ${STAGE_DIR}
30 WORKDIR ${STAGE_DIR}
31 RUN git clone https://github.com/protocolbuffers/protobuf.git
32 WORKDIR ${STAGE_DIR}/protobuf
33 RUN ./autogen.sh
34 RUN ./configure
35 RUN make clean
36 RUN make
37 RUN make install
38 RUN ldconfig
39 WORKDIR ${STAGE_DIR}
40 RUN git clone https://github.com/protobuf-c/protobuf-c.git
41 WORKDIR protobuf-c
42 RUN ./autogen.sh
43 ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
44 RUN ./configure
45 RUN make
46 RUN make install
47 RUN ldconfig
48 RUN pip install protobuf
49 WORKDIR ${STAGE_DIR}
50 RUN git clone -b Amber https://gerrit.o-ran-sc.org/r/com/gs-lite
51 WORKDIR ${STAGE_DIR}/gs-lite
52 COPY mc/cfg ${STAGE_DIR}/gs-lite/cfg
53 COPY mc/local_datasource ${STAGE_DIR}/gs-lite/src/lib/gscprts/local_datasource
54 COPY mc/local ${STAGE_DIR}/gs-lite/include/lfta/local
55 COPY mc/queries ${STAGE_DIR}/gs-lite/demo/queries
56 RUN ./build_and_install.sh
57 WORKDIR ${STAGE_DIR}/gs-lite/demo/queries
58 ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite
59 RUN bash ${STAGE_DIR}/gs-lite/bin/buildit
60
61 # Update & installation of linux packages
62 RUN apt-get update -y && \
63         apt-get install -y curl && \
64         apt-get install -y procps && \
65         apt-get install -y python-pip
66
67 # now install the binaries and libraries into smaller docker image
68 # use the mc_listener container as the base; all of it's stuff is in /playpen and can
69 # stay where it is
70 #
71 FROM nexus3.o-ran-sc.org:10004/o-ran-sc/ric-app-mc-listener:1.3.2
72
73 ARG STAGE_DIR
74
75 COPY --from=project-build ${STAGE_DIR}/gs-lite/demo/queries /mc/gs-lite/demo/queries
76 COPY --from=project-build ${STAGE_DIR}/gs-lite/bin /mc/gs-lite/bin
77 COPY --from=project-build ${STAGE_DIR}/data_gen /mc/data_gen
78 COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /mc/
79 COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/
80 COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/
81
82 COPY container_start.sh /playpen/bin/
83
84 RUN apt-get update && \
85     apt-get install -y curl python python-pip && \
86     apt-get clean
87
88 RUN ldconfig
89 RUN pip install protobuf
90
91 ENV XAPP_DESCRIPTOR_PATH /mc/mc_deployment.json
92 WORKDIR /playpen
93 ENV GSLITE_ROOT /mc/gs-lite
94
95 CMD ["/playpen/bin/container_start.sh"]