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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
17 ########################################################################
19 FROM ubuntu:20.04 as INSTALL
23 RUN 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
31 RUN git clone https://osm.etsi.org/gerrit/osm/common.git
32 RUN git clone https://osm.etsi.org/gerrit/osm/IM.git
34 RUN python3 -m pip install \
36 -r common/requirements.txt \
37 -r IM/requirements.txt
39 RUN python3 -m build /build/common && \
40 python3 -m pip install /build/common/dist/*.whl
42 RUN python3 -m build /build/IM && \
43 python3 -m pip install /build/IM/dist/*.whl
45 RUN python3 -m build /build && \
46 python3 -m pip install /build/dist/*.whl
49 FROM ubuntu:20.04 as FINAL
51 RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
52 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal
54 COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
55 COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
57 RUN mkdir -p /app/storage/kafka && mkdir -p /app/log
63 RUN cp -R /usr/local/lib/python3.8/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
64 RUN cp /usr/local/lib/python3.8/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
65 RUN cp -R /usr/local/lib/python3.8/dist-packages/osm_nbi/http /app/osm_nbi/
67 # Used for local storage
72 # The following ENV can be added with "docker run -e xxx' to configure
74 ENV OSMNBI_SOCKET_HOST 0.0.0.0
75 ENV OSMNBI_SOCKET_PORT 9999
76 ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/osm_nbi/http/cert.pem
77 ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/osm_nbi/http/privkey.pem
80 ENV OSMNBI_STORAGE_PATH /app/storage
83 ENV OSMNBI_DATABASE_DRIVER mongo
84 ENV OSMNBI_DATABASE_URI mongodb://mongo:27017
85 #ENV OSMNBI_DATABASE_HOST mongo
86 #ENV OSMNBI_DATABASE_PORT 27017
89 ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public
92 ENV OSMNBI_MESSAGE_DRIVER kafka
93 ENV OSMNBI_MESSAGE_HOST kafka
94 ENV OSMNBI_MESSAGE_PORT 9092
97 ENV OSMNBI_LOG_FILE /app/log/nbi.log
98 ENV OSMNBI_LOG_LEVEL DEBUG
101 ENV OSMNBI_AUTHENTICATION_BACKEND internal
102 #ENV OSMNBI_AUTHENTICATION_BACKEND keystone
103 #ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone
104 #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
112 ENV OSMNBI_PROMETHEUS_HOST prometheus
113 ENV OSMNBI_PROMETHEUS_PORT 9090
115 # Run app.py when the container launches
116 CMD ["python3", "-u", "-m", "osm_nbi.nbi"]