31c986fe819b0ba909d9f6e8ad621bf1a4dfb2ab
[ric-app/mc.git] / sidecars / listener / Dockerfile
1 # vim: ts=4 sw=4 noet:
2 #==================================================================================
3 #       Copyright (c) 2018-2019 AT&T Intellectual Property.
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #          http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #==================================================================================
17
18
19 #       Mnemonic:       Dockerfile
20 #       Abstract:       Build file which creaes a runtime image for the listener. 
21 #                               Building should be as simple as:
22 #
23 #                                       docker build -f sidecars/listener/Dockerfile -t mc_listener:xx.xx .
24 #
25 #                               Running the image in a container:
26 #                                       The fifo output directory needs to be mounted to the container
27 #                                       e.g.  -v /exports/mcl/fifos:/tmp/mcl/fifos.  The internal
28 #                                       directory can be supplied on the command line using -d path, but
29 #                                       should not be needed.
30 #
31 #                                       The RMR listen port must be properly exposed to the container. The
32 #                                       internal default is 4560, and can be changed with the -p port option
33 #                                       on the command line (needed if running from docker-compose). Typical
34 #                                       exposure might be  -p <host-port>:4560  on the docker run command.
35 #
36 #                                       The MC listener application does NOT need route table updates and thus
37 #                                       there is NO need to expose the route table generator port on this
38 #                                       container.
39 #
40 #       Date:           22 August 2019
41 #       Author:         E. Scott Daniels
42
43
44 FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:2-u16.04-nng as buildenv
45 RUN mkdir /playpen
46
47 RUN apt-get update && apt-get install -y cmake gcc make git g++ wget
48
49 WORKDIR /playpen
50 # Install RMr (runtime and dev) from debian package cached on packagecloud.io
51 ARG RMR_VER=1.10.2
52
53 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
54 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
55 RUN dpkg -i rmr_${RMR_VER}_amd64.deb
56 RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
57
58 RUN mkdir /playpen/bin /playpen/src
59 ARG SRC=.
60 COPY ${SRC}/Makefile ${SRC}/*.h ${SRC}/*.c /playpen/src/
61
62 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
63 ENV C_INCLUDE_PATH=/usr/local/include
64 RUN cd /playpen/src/; make -B mc_listener sender pipe_reader rdc_replay rdc_extract
65
66 # -----  final, smaller image ----------------------------------
67 FROM ubuntu:18.04
68
69 # bash doesn't cut it for run_replay so grab a real shell and clean up as much as we can
70 RUN apt-get update; apt-get install -y ksh
71 RUN rm -fr /var/lib/apt/lists 
72
73 # obtusely this uses the previous value
74 ARG SRC
75
76 RUN mkdir -p /playpen/bin
77 COPY --from=buildenv /usr/local/lib/* /usr/local/lib/
78 COPY --from=buildenv /playpen/src/mc_listener /playpen/src/sender /playpen/src/pipe_reader /playpen/src/rdc_replay /playpen/src/rdc_extract /playpen/bin/
79 COPY ${SRC}/verify_replay.sh ${SRC}/verify.sh ${SRC}run_replay.sh ${SRC}/help /playpen/bin/
80
81 ENV PATH=/playpen/bin:$PATH
82 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
83 ENV C_INCLUDE_PATH=/usr/local/include
84
85 CMD [ "/playpen/bin/mc_listener" ]