blob: 11dd71d7b2e73d8fb95fcc50408aec691f4a39fa [file] [log] [blame]
Adam Israele83834a2019-11-13 16:05:49 -08001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
Mike Marchetti13d76c82018-09-19 15:00:36 -040013# This creates som/LCM docker from from last stable package
14
15FROM ubuntu:16.04
16
17# Set the working directory to /app
18WORKDIR /app/osm_lcm
19
20# avoid extra information from packages
21RUN echo 'path-exclude /usr/share/doc/*\n\
22path-include /usr/share/doc/*/copyright\n\
23path-exclude /usr/share/man/*\n\
24path-exclude /usr/share/groff/*\n\
25path-exclude /usr/share/info/*\n\
26path-exclude /usr/share/lintian/*\n\
27path-exclude /usr/share/linda/*\n'\
28> /etc/dpkg/dpkg.cfg.d/01_nodoc && \
29 echo 'APT::Install-Recommends "false";\n\
30APT::AutoRemove::RecommendsImportant "false";\n\
31APT::AutoRemove::SuggestsImportant "false";\n'\
32> /etc/apt/apt.conf.d/99_norecommends
33
34RUN apt-get update && apt-get -y install curl software-properties-common
35
36RUN apt-get update && apt-get install -y git make python3 \
37 python3-pip python3-pymongo python3-yaml python3-aiohttp \
Michael Marchettib1287f52018-10-31 22:23:02 +000038 python3-all python3-setuptools openssh-client libffi-dev libssl-dev \
Mike Marchetti13d76c82018-09-19 15:00:36 -040039 python3-bitarray python3-regex python3-lxml dh-python wget tox \
40 python3-cffi \
41 && pip3 install pip==9.0.3 \
42 && pip3 install -U aiokafka pyang lxml six enum34 \
43 && pip3 install websockets==4.0.1 \
Michael Marchettib1287f52018-10-31 22:23:02 +000044 && pip3 install requests \
David Garcia8c3630e2019-11-14 10:05:06 +010045 && pip3 install cffi==1.13.2 \
Michael Marchettib1287f52018-10-31 22:23:02 +000046 && rm -rf /var/lib/apt/lists/*
garciadeblas77f468c2018-10-26 23:13:37 +020047
tierno38e11d72018-10-30 14:56:28 +010048# packages needed for N2VC because deb dependencies are not fine
49RUN pip3 install 'macaroonbakery>=1.1,<2.0' 'pyRFC3339>=1.0,<2.0' \
50 'pyyaml>=3.0,<4.0' 'theblues>=0.3.8,<1.0' 'websockets>=4.0,<5.0' \
51 'paramiko' # PyNaCl
52#
53# RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
54# && cd N2VC \
55# && cd modules/libjuju && python3 setup.py develop && cd ../.. \
56# && pip3 install -U -r requirements.txt
Mike Marchetti13d76c82018-09-19 15:00:36 -040057
58ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
59ARG RELEASE=ReleaseFOUR-daily
60ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
61ARG REPOSITORY=testing
62
63RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
64RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
65
66ARG LCM_VERSION
67ARG COMMON_VERSION
68ARG N2VC_VERSION
69
70RUN apt-get update && apt-get install -y python3-osm-lcm${LCM_VERSION} \
71 python3-osm-common${COMMON_VERSION} \
72 python3-n2vc${N2VC_VERSION} \
73 && rm -rf /var/lib/apt/lists/*
74
75EXPOSE 9999
76
77LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
78 Description="This implements life cycle management engine for OSM" \
79 Version="1.0" \
80 Author="Alfonso Tierno"
81
82# Used for local storage
83VOLUME /app/storage
84# Used for logs
85VOLUME /app/log
86
87# The following ENV can be added with "docker run -e xxx' to configure LCM
88ENV OSMLCM_RO_HOST ro
89ENV OSMLCM_RO_PORT 9090
90ENV OSMLCM_RO_TENANT osm
91
92# VCA
93ENV OSMLCM_VCA_HOST vca
94ENV OSMLCM_VCA_PORT: 17070
95ENV OSMLCM_VCA_USER: admin
96ENV OSMLCM_VCA_SECRET: secret
97
98# database
99ENV OSMLCM_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -0300100ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
101#ENV OSMLCM_DATABASE_HOST mongo
102#ENV OSMLCM_DATABASE_PORT 27017
103
104
Mike Marchetti13d76c82018-09-19 15:00:36 -0400105ENV OSMLCM_STORAGE_DRIVER local
106ENV OSMLCM_STORAGE_PATH /app/storage
107
108# message
109ENV OSMLCM_MESSAGE_DRIVER kafka
110ENV OSMLCM_MESSAGE_HOST kafka
111ENV OSMLCM_MESSAGE_PORT 9092
112
tierno84a3c9a2018-10-24 11:02:57 +0200113HEALTHCHECK --interval=30s --timeout=140s --retries=1 \
114 CMD python3 /usr/lib/python3/dist-packages/osm_lcm/lcm.py --health-check || exit 1
115
116
Mike Marchetti13d76c82018-09-19 15:00:36 -0400117# Run app.py when the container launches
118CMD ["python3", "/usr/lib/python3/dist-packages/osm_lcm/lcm.py"]