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