| garciadeblas | b1bcbf9 | 2020-09-11 14:24:54 +0000 | [diff] [blame] | 1 | # 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 |
| 10 | # implied. |
| 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. |
| 13 | |
| 14 | # This creates osm/NBI docker from local NBI source code |
| 15 | |
| 16 | FROM ubuntu:18.04 |
| 17 | |
| 18 | # Set the working directory to /app |
| 19 | WORKDIR /app/NBI |
| 20 | |
| 21 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
| 22 | |
| 23 | RUN apt-get update && apt-get install -y git python3 \ |
| 24 | python3-pymongo python3-yaml python3-pip python3-keystoneclient \ |
| 25 | && python3 -m pip install pip --upgrade \ |
| 26 | && python3 -m pip install aiokafka aiohttp cherrypy==18.1.2 keystoneauth1 requests jsonschema==3.2.0 \ |
| 27 | && mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 28 | |
| 29 | # OSM_COMMON |
| 30 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \ |
| 31 | && git -C /app/common checkout master \ |
| 32 | && python3 -m pip install -e /app/common |
| 33 | # && cd common && python3 setup.py develop && cd .. |
| 34 | # && pip3 install -U -r requirements.txt \ |
| 35 | # && cd .. |
| 36 | |
| 37 | # OSM_IM |
| 38 | RUN git -C /app clone https://osm.etsi.org/gerrit/osm/IM \ |
| 39 | && git -C /app/IM checkout master \ |
| 40 | && python3 -m pip install /app/IM |
| 41 | |
| 42 | EXPOSE 9999 |
| 43 | |
| 44 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| 45 | Description="This implements a north bound interface for OSM" \ |
| 46 | Version="1.0" \ |
| 47 | Author="Alfonso Tierno" |
| 48 | |
| 49 | # Used for local storage |
| 50 | VOLUME /app/storage |
| 51 | # Used for logs |
| 52 | VOLUME /app/log |
| 53 | |
| 54 | # The following ENV can be added with "docker run -e xxx' to configure |
| 55 | # server |
| 56 | ENV OSMNBI_SOCKET_HOST 0.0.0.0 |
| 57 | ENV OSMNBI_SOCKET_PORT 9999 |
| 58 | ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/NBI/osm_nbi/http/cert.pem |
| 59 | ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/NBI/osm_nbi/http/privkey.pem |
| 60 | # storage |
| 61 | ENV OSMNBI_STORAGE_DRIVER local |
| 62 | ENV OSMNBI_STORAGE_PATH /app/storage |
| 63 | #ENV OSMNBI_STORAGE_DRIVER mongo |
| 64 | #ENV OSMNBI_STORAGE_URI mongodb://mongo:27017 |
| 65 | #ENV OSMNBI_STORAGE_COLLECTION files |
| 66 | # database |
| 67 | ENV OSMNBI_DATABASE_DRIVER mongo |
| 68 | ENV OSMNBI_DATABASE_HOST mongo |
| 69 | ENV OSMNBI_DATABASE_PORT 27017 |
| 70 | # ENV OSMNBI_DATABASE_USER xxx |
| 71 | # ENV OSMNBI_DATABASE_PASSWORD xxx |
| 72 | # ENV OSMNBI_DATABASE_COMMONKEY xxx |
| 73 | # web |
| 74 | ENV OSMNBI_STATIC_DIR /app/NBI/osm_nbi/html_public |
| 75 | # logs |
| 76 | # ENV OSMNBI_LOG_FILE /app/log/nbi.log |
| 77 | ENV OSMNBI_LOG_LEVEL DEBUG |
| 78 | # ENV OSMNBI_SERVER_ENABLE_TEST False |
| 79 | |
| 80 | # message |
| 81 | ENV OSMNBI_MESSAGE_DRIVER kafka |
| 82 | ENV OSMNBI_MESSAGE_HOST kafka |
| 83 | ENV OSMNBI_MESSAGE_PORT 9092 |
| 84 | # authentication |
| 85 | ENV OSMNBI_AUTHENTICATION_BACKEND internal |
| 86 | #ENV OSMNBI_AUTHENTICATION_BACKEND keystone |
| 87 | #ENV OSMNBI_AUTHENTICATION_AUTH_URL http://keystone:5000/v3 |
| 88 | #ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000 |
| 89 | |
| 90 | # DOMAIN_NAME can be a single value or a comma separated list of values. The first value is for internal domain |
| 91 | # meanwhile the rest ones are external identity services as e.g. LDAP |
| 92 | # for the case of USER_DOMAIN_NAME each item can be suffixed with ":ro" (read only). In this case NBI will reject any |
| 93 | # operationi of create/update/delete users in this domain. Do not suffix PROJECT_DOMAIN_NAME |
| 94 | #ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default |
| 95 | #ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default |
| 96 | #ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi |
| 97 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi |
| 98 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service |
| 99 | # RBAC |
| 100 | ENV OSMNBI_RBAC_RESOURCES_TO_OPERATIONS /app/NBI/osm_nbi/resources_to_operations.yml |
| 101 | ENV OSMNBI_RBAC_ROLES_TO_OPERATIONS /app/NBI/osm_nbi/roles_to_operations.yml |
| 102 | # prometheus |
| 103 | ENV OSMNBI_PROMETHEUS_HOST prometheus |
| 104 | ENV OSMNBI_PROMETHEUS_PORT 9090 |
| 105 | |
| 106 | # Copy the current directory contents into the container at /app |
| 107 | ADD . /app/NBI |
| 108 | |
| 109 | # Run app.py when the container launches |
| 110 | CMD python3 -m osm_nbi.nbi |