adding healthcheck to LCM
[osm/devops.git] / docker / LCM / Dockerfile
1 # This creates som/LCM docker from from last stable package
2
3 FROM ubuntu:16.04
4
5 # Set the working directory to /app
6 WORKDIR /app/osm_lcm
7
8 # avoid extra information from packages
9 RUN echo 'path-exclude /usr/share/doc/*\n\
10 path-include /usr/share/doc/*/copyright\n\
11 path-exclude /usr/share/man/*\n\
12 path-exclude /usr/share/groff/*\n\
13 path-exclude /usr/share/info/*\n\
14 path-exclude /usr/share/lintian/*\n\
15 path-exclude /usr/share/linda/*\n'\
16 > /etc/dpkg/dpkg.cfg.d/01_nodoc && \
17     echo  'APT::Install-Recommends "false";\n\
18 APT::AutoRemove::RecommendsImportant "false";\n\
19 APT::AutoRemove::SuggestsImportant "false";\n'\
20 > /etc/apt/apt.conf.d/99_norecommends
21
22 RUN apt-get update && apt-get -y install curl software-properties-common
23
24 RUN apt-get update && apt-get install -y git make python3 \
25     python3-pip python3-pymongo python3-yaml python3-aiohttp \
26     python3-all python3-setuptools \
27     python3-bitarray python3-regex python3-lxml dh-python wget tox \
28     python3-cffi \
29     && pip3 install pip==9.0.3 \
30     && pip3 install -U aiokafka pyang lxml six enum34 \
31     && pip3 install websockets==4.0.1 \
32     && pip3 install requests
33
34 RUN pip3 install PyNaCl
35
36 RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
37     && cd N2VC \
38     && git checkout BUILD_v4.0.1_1 \
39     && cd modules/libjuju && python3 setup.py develop && cd ../.. \
40     && pip3 install -U -r requirements.txt
41
42 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
43 ARG RELEASE=ReleaseFOUR-daily
44 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
45 ARG REPOSITORY=testing
46
47 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
48 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
49
50 ARG LCM_VERSION
51 ARG COMMON_VERSION
52 ARG N2VC_VERSION
53
54 RUN apt-get update && apt-get install -y python3-osm-lcm${LCM_VERSION} \
55                                          python3-osm-common${COMMON_VERSION} \
56                                          python3-n2vc${N2VC_VERSION} \
57                                          && rm -rf /var/lib/apt/lists/*
58
59 EXPOSE 9999
60
61 LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
62       Description="This implements life cycle management engine for OSM" \
63       Version="1.0" \
64       Author="Alfonso Tierno"
65
66 # Used for local storage
67 VOLUME /app/storage
68 # Used for logs
69 VOLUME /app/log
70
71 # The following ENV can be added with "docker run -e xxx' to configure LCM
72 ENV OSMLCM_RO_HOST         ro
73 ENV OSMLCM_RO_PORT         9090
74 ENV OSMLCM_RO_TENANT       osm
75
76 # VCA
77 ENV OSMLCM_VCA_HOST        vca
78 ENV OSMLCM_VCA_PORT:       17070
79 ENV OSMLCM_VCA_USER:       admin
80 ENV OSMLCM_VCA_SECRET:     secret
81
82 # database
83 ENV OSMLCM_DATABASE_DRIVER mongo
84 ENV OSMLCM_DATABASE_HOST   mongo
85 ENV OSMLCM_DATABASE_PORT   27017
86 ENV OSMLCM_STORAGE_DRIVER  local
87 ENV OSMLCM_STORAGE_PATH    /app/storage
88
89 # message
90 ENV OSMLCM_MESSAGE_DRIVER  kafka
91 ENV OSMLCM_MESSAGE_HOST    kafka
92 ENV OSMLCM_MESSAGE_PORT    9092
93
94 HEALTHCHECK --interval=30s --timeout=140s --retries=1 \
95   CMD python3 /usr/lib/python3/dist-packages/osm_lcm/lcm.py --health-check || exit 1
96
97
98 # Run app.py when the container launches
99 CMD ["python3", "/usr/lib/python3/dist-packages/osm_lcm/lcm.py"]