| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 1 | # Copyright 2018 Telefonica S.A. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | # implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 16 | FROM ubuntu:16.04 |
| 17 | |
| 18 | # Set the working directory to /app |
| tierno | 2b82991 | 2019-08-30 15:21:05 +0000 | [diff] [blame] | 19 | WORKDIR /app/LCM |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 20 | |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 21 | RUN apt-get update && apt-get install -y git tox python3 \ |
| tierno | 2b611dd | 2019-01-11 10:30:57 +0000 | [diff] [blame] | 22 | python3-pip python3-aiohttp python3-jinja2 \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame^] | 23 | && python3 -m pip install pip --upgrade \ |
| 24 | && python3 -m pip install -U 'PyYAML==3.*' 'aiohttp==0.20.2' flake8 |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 25 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 26 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/N2VC.git \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame^] | 27 | && python3 -m pip install -e /app/N2VC \ |
| 28 | && python3 -m pip install -U juju \ |
| tierno | f578e55 | 2018-11-08 19:07:20 +0100 | [diff] [blame] | 29 | && apt-get install -y libffi-dev libssl-dev openssh-client |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 30 | # cd N2VC; python3 setup.py develop |
| 31 | # cd modules/libjuju; python3 setup.py develop |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 32 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 33 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \ |
| tierno | 62b2cd7 | 2019-11-21 12:25:34 +0000 | [diff] [blame^] | 34 | && python3 -m pip install -e /app/common |
| tierno | b3cda2e | 2018-10-30 17:26:59 +0000 | [diff] [blame] | 35 | # python3-pymongo python3-yaml pycrypto aiokafka |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 36 | |
| 37 | RUN mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 38 | |
| 39 | |
| 40 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| tierno | 8d95001 | 2018-05-22 12:27:48 +0200 | [diff] [blame] | 41 | Description="This implements the Life Cicle Management module of OSM" \ |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 42 | Version="1.0" \ |
| 43 | Author="Alfonso Tierno" |
| 44 | |
| 45 | # Used for local storage |
| 46 | VOLUME /app/storage |
| 47 | # Used for logs |
| 48 | VOLUME /app/log |
| 49 | |
| 50 | # The following ENV can be added with "docker run -e xxx' to configure LCM |
| 51 | ENV OSMLCM_RO_HOST ro |
| 52 | ENV OSMLCM_RO_PORT 9090 |
| 53 | ENV OSMLCM_RO_TENANT osm |
| 54 | |
| 55 | # VCA |
| 56 | ENV OSMLCM_VCA_HOST vca |
| 57 | ENV OSMLCM_VCA_PORT: 17070 |
| 58 | ENV OSMLCM_VCA_USER: admin |
| 59 | ENV OSMLCM_VCA_SECRET: secret |
| tierno | 9597c29 | 2019-02-06 09:21:27 +0000 | [diff] [blame] | 60 | # ENV OSMLCM_VCA_PUBKEY: pubkey |
| 61 | # ENV OSMLCM_VCA_CACERT: cacert |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 62 | |
| 63 | # database |
| 64 | ENV OSMLCM_DATABASE_DRIVER mongo |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 65 | ENV OSMLCM_DATABASE_URI mongodb://mongo:27017 |
| 66 | # ENV OSMLCM_DATABASE_COMMONKEY xxx |
| tierno | 17a612f | 2018-10-23 11:30:42 +0200 | [diff] [blame] | 67 | # ENV OSMLCM_DATABASE_USER xxx |
| 68 | # ENV OSMLCM_DATABASE_PASSWORD xxx |
| tierno | 17a612f | 2018-10-23 11:30:42 +0200 | [diff] [blame] | 69 | |
| 70 | #storage |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 71 | ENV OSMLCM_STORAGE_DRIVER local |
| 72 | ENV OSMLCM_STORAGE_PATH /app/storage |
| 73 | |
| 74 | # message |
| 75 | ENV OSMLCM_MESSAGE_DRIVER kafka |
| 76 | ENV OSMLCM_MESSAGE_HOST kafka |
| 77 | ENV OSMLCM_MESSAGE_PORT 9092 |
| 78 | |
| tierno | 275411e | 2018-05-16 14:33:32 +0200 | [diff] [blame] | 79 | # logs |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 80 | # ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log |
| tierno | 275411e | 2018-05-16 14:33:32 +0200 | [diff] [blame] | 81 | ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG |
| 82 | |
| tierno | f7e0a64 | 2018-11-17 01:01:52 +0100 | [diff] [blame] | 83 | # Copy the current directory contents into the container at /app/LCM |
| 84 | ADD . /app/LCM |
| Felipe Vicens | c2033f2 | 2018-11-15 15:09:58 +0100 | [diff] [blame] | 85 | |
| tierno | c0e42e2 | 2018-05-11 11:36:10 +0200 | [diff] [blame] | 86 | # Run app.py when the container launches |
| tierno | 2b82991 | 2019-08-30 15:21:05 +0000 | [diff] [blame] | 87 | CMD python3 -m osm_lcm.lcm |
| tierno | a9843d8 | 2018-10-24 10:44:20 +0200 | [diff] [blame] | 88 | |
| tierno | 3e359b1 | 2019-02-03 02:29:13 +0100 | [diff] [blame] | 89 | # HEALTHCHECK --interval=120s --timeout=15s --retries=1 \ |
| tierno | 2b82991 | 2019-08-30 15:21:05 +0000 | [diff] [blame] | 90 | # CMD python3 -m osm_lcm.lcm --health-check || exit 1 |