blob: 4ac2a495c8d7fdd5293c937fcbf41eeef9b0e330 [file] [log] [blame]
calvinosanchbfb77902019-07-31 13:31:16 +00001##
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
David Garciaa60ec732021-03-17 15:28:47 +010019FROM ubuntu:18.04 as INSTALL
Mike Marchetti182bd732018-09-05 09:52:42 -040020
David Garciaa60ec732021-03-17 15:28:47 +010021RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
22 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedufd164af2021-08-12 15:35:51 +010023 gcc=4:7.4.* \
24 python3=3.6.* \
25 python3-dev=3.6.* \
26 python3-setuptools=39.0.* \
27 curl=7.58.* && \
sousaeducb992762021-08-31 18:52:26 +010028 python3 -m easy_install pip==21.0.1 setuptools==51.0.0
Mike Marchetti182bd732018-09-05 09:52:42 -040029
David Garciaa60ec732021-03-17 15:28:47 +010030ARG PYTHON3_OSM_COMMON_URL
31ARG PYTHON3_OSM_IM_URL
32ARG PYTHON3_OSM_NBI_URL
Mike Marchetti182bd732018-09-05 09:52:42 -040033
David Garciaa60ec732021-03-17 15:28:47 +010034RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
35RUN dpkg -i ./osm_common.deb
fonsecajf404b8b2021-02-11 14:08:52 +010036
David Garciaa60ec732021-03-17 15:28:47 +010037RUN curl $PYTHON3_OSM_IM_URL -o osm_im.deb
38RUN dpkg -i ./osm_im.deb
fonsecajf404b8b2021-02-11 14:08:52 +010039
David Garciaa60ec732021-03-17 15:28:47 +010040RUN curl $PYTHON3_OSM_NBI_URL -o osm_nbi.deb
41RUN dpkg -i ./osm_nbi.deb
fonsecajf404b8b2021-02-11 14:08:52 +010042
David Garciaa60ec732021-03-17 15:28:47 +010043RUN pip3 install \
44 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
45 -r /usr/lib/python3/dist-packages/osm_im/requirements.txt \
46 -r /usr/lib/python3/dist-packages/osm_nbi/requirements.txt
fonsecajf404b8b2021-02-11 14:08:52 +010047
David Garciaa60ec732021-03-17 15:28:47 +010048FROM ubuntu:18.04 as FINAL
fonsecajf404b8b2021-02-11 14:08:52 +010049
David Garciaa60ec732021-03-17 15:28:47 +010050RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas6ba74b52021-09-23 17:43:15 +020051 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal=3.6.* \
52 && rm -rf /var/lib/apt/lists/*
fonsecajf404b8b2021-02-11 14:08:52 +010053
David Garciaa60ec732021-03-17 15:28:47 +010054COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
55COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
Mike Marchetti13d76c82018-09-19 15:00:36 -040056
David Garciaa60ec732021-03-17 15:28:47 +010057RUN mkdir -p /app/storage/kafka && mkdir -p /app/log
Mike Marchetti182bd732018-09-05 09:52:42 -040058
Mike Marchetti182bd732018-09-05 09:52:42 -040059WORKDIR /app/osm_nbi
60
Mike Marchetti182bd732018-09-05 09:52:42 -040061EXPOSE 9999
62
Mike Marchetti13d76c82018-09-19 15:00:36 -040063RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
64RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
65RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/
66
Mike Marchetti182bd732018-09-05 09:52:42 -040067# 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
74ENV OSMNBI_SOCKET_HOST 0.0.0.0
75ENV OSMNBI_SOCKET_PORT 9999
tierno2c002c92019-09-13 12:57:35 +000076ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/osm_nbi/http/cert.pem
77ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/osm_nbi/http/privkey.pem
Mike Marchetti182bd732018-09-05 09:52:42 -040078# storage
79ENV OSMNBI_STORAGE_PATH /app/storage
80# database
81ENV OSMNBI_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -030082ENV OSMNBI_DATABASE_URI mongodb://mongo:27017
83#ENV OSMNBI_DATABASE_HOST mongo
84#ENV OSMNBI_DATABASE_PORT 27017
85
Mike Marchetti182bd732018-09-05 09:52:42 -040086# web
Mike Marchetti13d76c82018-09-19 15:00:36 -040087ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public
Mike Marchetti182bd732018-09-05 09:52:42 -040088# message
89ENV OSMNBI_MESSAGE_DRIVER kafka
90ENV OSMNBI_MESSAGE_HOST kafka
91ENV OSMNBI_MESSAGE_PORT 9092
92# logs
93ENV OSMNBI_LOG_FILE /app/log/nbi.log
94ENV OSMNBI_LOG_LEVEL DEBUG
Eduardo Sousae193dfd2018-09-21 11:37:49 +010095# authentication
96ENV OSMNBI_AUTHENTICATION_BACKEND internal
97#ENV OSMNBI_AUTHENTICATION_BACKEND keystone
98#ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone
99#ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000
100#ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default
101#ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default
102#ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi
103#ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi
104#ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service
vijay.rbdb48022019-05-06 15:38:23 +0530105#prometheus
106ENV OSMNBI_PROMETHEUS_HOST prometheus
107ENV OSMNBI_PROMETHEUS_PORT 9090
Mike Marchetti182bd732018-09-05 09:52:42 -0400108
tierno836e9db2019-07-22 13:23:56 +0000109HEALTHCHECK --start-period=120s --interval=10s --timeout=5s --retries=5 \
Mike Marchetti851aac22018-09-20 10:18:01 -0400110 CMD curl -k https://localhost:9999/osm/ | grep Welcome || exit 1
111
Mike Marchetti182bd732018-09-05 09:52:42 -0400112# Run app.py when the container launches
tierno2c002c92019-09-13 12:57:35 +0000113CMD python3 -m osm_nbi.nbi
114