Initial commit of mc-core part of mc xApp codebase
[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:1-u16.04-nng1.1.1 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 git clone https://github.com/protocolbuffers/protobuf.git
31 WORKDIR ${STAGE_DIR}/protobuf
32 RUN ./autogen.sh
33 RUN ./configure
34 RUN make clean
35 RUN make
36 RUN make install
37 RUN ldconfig
38 WORKDIR ${STAGE_DIR}
39 RUN git clone https://github.com/protobuf-c/protobuf-c.git
40 WORKDIR protobuf-c
41 RUN ./autogen.sh
42 ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
43 RUN ./configure
44 RUN make
45 RUN make install
46 RUN ldconfig
47 RUN pip install protobuf
48 WORKDIR ${STAGE_DIR}
49 RUN git clone https://gerrit.o-ran-sc.org/r/com/gs-lite
50 WORKDIR ${STAGE_DIR}/gs-lite
51 COPY mc/cfg ${STAGE_DIR}/gs-lite/cfg
52 COPY mc/local_datasource ${STAGE_DIR}/gs-lite/src/lib/gscprts/local_datasource
53 COPY mc/local ${STAGE_DIR}/gs-lite/include/lfta/local
54 COPY mc/queries ${STAGE_DIR}/gs-lite/demo/queries
55 RUN ./build_and_install.sh
56 WORKDIR ${STAGE_DIR}/gs-lite/demo/queries
57 ENV GSLITE_ROOT ${STAGE_DIR}/gs-lite
58 RUN bash ${STAGE_DIR}/gs-lite/bin/buildit
59
60
61 # now install the binaries and libraries into smaller docker image
62 FROM ubuntu:16.04
63
64 ARG STAGE_DIR
65
66 COPY --from=project-build ${STAGE_DIR}/gs-lite/demo/queries /mc/gs-lite/demo/queries
67 COPY --from=project-build ${STAGE_DIR}/gs-lite/bin /mc/gs-lite/bin
68 COPY --from=project-build ${STAGE_DIR}/data_gen /mc/data_gen
69 COPY --from=project-build ${STAGE_DIR}/mc_deployment.json /mc/
70 COPY --from=project-build ${STAGE_DIR}/extract_params.py /mc/
71 COPY --from=project-build /usr/local/lib/libproto* /usr/local/lib/
72
73 RUN apt-get update && \
74     apt-get install -y curl python python-pip && \
75     apt-get clean
76
77 RUN ldconfig
78 RUN pip install protobuf
79
80 ENV XAPP_DESCRIPTOR_PATH /mc/mc_deployment.json
81 WORKDIR /mc/gs-lite/demo/queries
82 ENV GSLITE_ROOT /mc/gs-lite
83 CMD ["./runall"]