blob: 04f2d2e56ad960016c2b3fbd69d794f74a54b473 [file] [log] [blame]
sousaedu786aedd2021-05-05 12:51:45 +02001##
2# Copyright ETSI
tiernod125caf2018-11-22 16:05:54 +00003#
sousaedu786aedd2021-05-05 12:51:45 +02004# 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
tiernod125caf2018-11-22 16:05:54 +00009#
10# Unless required by applicable law or agreed to in writing, software
sousaedu786aedd2021-05-05 12:51:45 +020011# 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##
tiernod125caf2018-11-22 16:05:54 +000016
sousaedu786aedd2021-05-05 12:51:45 +020017########################################################################
tiernoa8d63632018-05-10 13:12:32 +020018
Pedro Escaleiraaa4f7122022-04-03 18:31:50 +010019FROM ubuntu:20.04 as INSTALL
Mike Marchettic678d042018-04-18 13:51:27 -040020
sousaedu786aedd2021-05-05 12:51:45 +020021WORKDIR /build
Mike Marchettic678d042018-04-18 13:51:27 -040022
sousaedu786aedd2021-05-05 12:51:45 +020023RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
24 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
25 gcc git python3 python3-dev python3-venv python3-pip \
26 python3-setuptools wget && \
27 python3 -m pip install -U pip build
calvinosanch675b8042020-01-09 16:10:12 +010028
sousaedu786aedd2021-05-05 12:51:45 +020029COPY . /build
tiernoaae4dc42018-06-11 18:55:50 +020030
sousaedu786aedd2021-05-05 12:51:45 +020031RUN git clone https://osm.etsi.org/gerrit/osm/common.git
32RUN git clone https://osm.etsi.org/gerrit/osm/IM.git
tiernoa8d63632018-05-10 13:12:32 +020033
sousaedu786aedd2021-05-05 12:51:45 +020034RUN python3 -m pip install \
35 -r requirements.txt \
36 -r common/requirements.txt \
37 -r IM/requirements.txt
38
39RUN python3 -m build /build/common && \
40 python3 -m pip install /build/common/dist/*.whl
41
42RUN python3 -m build /build/IM && \
43 python3 -m pip install /build/IM/dist/*.whl
44
45RUN python3 -m build /build && \
46 python3 -m pip install /build/dist/*.whl
47
48
Pedro Escaleiraaa4f7122022-04-03 18:31:50 +010049FROM ubuntu:20.04 as FINAL
sousaedu786aedd2021-05-05 12:51:45 +020050
51RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
52 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal
53
54COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
Pedro Escaleiraaa4f7122022-04-03 18:31:50 +010055COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
sousaedu786aedd2021-05-05 12:51:45 +020056
57RUN mkdir -p /app/storage/kafka && mkdir -p /app/log
58
59WORKDIR /app/osm_nbi
Mike Marchettic678d042018-04-18 13:51:27 -040060
61EXPOSE 9999
62
Pedro Escaleiraaa4f7122022-04-03 18:31:50 +010063RUN cp -R /usr/local/lib/python3.8/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
64RUN cp /usr/local/lib/python3.8/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
65RUN cp -R /usr/local/lib/python3.8/dist-packages/osm_nbi/http /app/osm_nbi/
Mike Marchettic678d042018-04-18 13:51:27 -040066
67# Used for local storage
68VOLUME /app/storage
69# Used for logs
70VOLUME /app/log
71
72# The following ENV can be added with "docker run -e xxx' to configure
73# server
sousaedu786aedd2021-05-05 12:51:45 +020074ENV OSMNBI_SOCKET_HOST 0.0.0.0
75ENV OSMNBI_SOCKET_PORT 9999
76ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/osm_nbi/http/cert.pem
77ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/osm_nbi/http/privkey.pem
78
Mike Marchettic678d042018-04-18 13:51:27 -040079# storage
sousaedu786aedd2021-05-05 12:51:45 +020080ENV OSMNBI_STORAGE_PATH /app/storage
81
Mike Marchettic678d042018-04-18 13:51:27 -040082# database
sousaedu786aedd2021-05-05 12:51:45 +020083ENV OSMNBI_DATABASE_DRIVER mongo
84ENV OSMNBI_DATABASE_URI mongodb://mongo:27017
85#ENV OSMNBI_DATABASE_HOST mongo
86#ENV OSMNBI_DATABASE_PORT 27017
87
Mike Marchettic678d042018-04-18 13:51:27 -040088# web
sousaedu786aedd2021-05-05 12:51:45 +020089ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public
tierno4836bac2020-01-15 14:41:48 +000090
Mike Marchettic678d042018-04-18 13:51:27 -040091# message
sousaedu786aedd2021-05-05 12:51:45 +020092ENV OSMNBI_MESSAGE_DRIVER kafka
93ENV OSMNBI_MESSAGE_HOST kafka
94ENV OSMNBI_MESSAGE_PORT 9092
95
96# logs
97ENV OSMNBI_LOG_FILE /app/log/nbi.log
98ENV OSMNBI_LOG_LEVEL DEBUG
99
Eduardo Sousa819d34c2018-07-31 01:20:02 +0100100# authentication
101ENV OSMNBI_AUTHENTICATION_BACKEND internal
102#ENV OSMNBI_AUTHENTICATION_BACKEND keystone
sousaedu786aedd2021-05-05 12:51:45 +0200103#ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone
Eduardo Sousa819d34c2018-07-31 01:20:02 +0100104#ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000
105#ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default
106#ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default
107#ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi
108#ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi
109#ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service
sousaedu786aedd2021-05-05 12:51:45 +0200110
111#prometheus
vijay.r35ef2f72019-04-30 17:55:49 +0530112ENV OSMNBI_PROMETHEUS_HOST prometheus
113ENV OSMNBI_PROMETHEUS_PORT 9090
Mike Marchettic678d042018-04-18 13:51:27 -0400114
Mike Marchettic678d042018-04-18 13:51:27 -0400115# Run app.py when the container launches
sousaedu786aedd2021-05-05 12:51:45 +0200116CMD ["python3", "-u", "-m", "osm_nbi.nbi"]