38ecfca70b6d4e21830032477aa5742aff22cb47
[ric-app/mc.git] / ci / 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 (listener)
20 #       Abstract:       Build file which creaes a runtime image for the listener. 
21 #                               Building should be as simple as:
22 #
23 #                                       docker build -f ci/listener/Dockerfile -t mc_listener:xx.xx .
24 #
25 #                               The build MUST be run from the repo root as it is impossible to 
26 #                               reference the needed source from inside of this directory.
27 #
28 #                               Running the image in a container:
29 #                                       The fifo output directory needs to be mounted to the container
30 #                                       e.g.  -v /exports/mcl/fifos:/tmp/mcl/fifos.  The internal
31 #                                       directory can be supplied on the command line using -d path, but
32 #                                       should not be needed.
33 #
34 #                                       The RMR listen port must be properly exposed to the container. The
35 #                                       internal default is 4560, and can be changed with the -p port option
36 #                                       on the command line (needed if running from docker-compose). Typical
37 #                                       exposure might be  -p <host-port>:4560  on the docker run command.
38 #
39 #                                       The MC listener application does NOT need route table updates and thus
40 #                                       there is NO need to expose the route table generator port on this
41 #                                       container.
42 #
43 #       Date:           22 August 2019
44 #       Author:         E. Scott Daniels
45
46
47 FROM ubuntu:18.04 as buildenv
48 RUN mkdir /playpen
49
50 RUN apt-get update && apt-get install -y cmake gcc make git g++ wget
51
52 RUN mkdir /playpen/bin /playpen/src
53 ARG SRC=sidecars/listener
54 COPY ${SRC}/build_dev_env.sh /playpen/bin/
55 COPY ${SRC}/Makefile ${SRC}/*.h ${SRC}/*.c /playpen/src/
56
57 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
58 ENV C_INCLUDE_PATH=/usr/local/include
59 RUN bash /playpen/bin/build_dev_env.sh
60 RUN cd /playpen/src/; make -B mc_listener sender pipe_reader
61
62 # -----  final, smaller image ----------------------------------
63 FROM ubuntu:18.04
64
65 # obtusely this uses the previous value
66 ARG SRC
67
68 RUN mkdir -p /playpen/bin
69 COPY --from=buildenv /usr/local/lib/* /usr/local/lib/
70 COPY --from=buildenv /playpen/src/mc_listener /playpen/src/sender /playpen/src/pipe_reader /playpen/bin/
71 COPY ${SRC}/verify.sh /playpen/bin
72
73 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
74 ENV C_INCLUDE_PATH=/usr/local/include
75
76 CMD [ "/playpen/bin/mc_listener" ]