blob: 64bad45298ae8a1d3b9b9a8bea4995cd7085492b [file] [log] [blame]
beierlme7646252022-01-13 10:53:08 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
calvinosanchbfb77902019-07-31 13:31:16 +00003#
beierlme7646252022-01-13 10:53:08 -05004# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
calvinosanchbfb77902019-07-31 13:31:16 +00007#
beierlme7646252022-01-13 10:53:08 -05008# http://www.apache.org/licenses/LICENSE-2.0
calvinosanchbfb77902019-07-31 13:31:16 +00009#
10# Unless required by applicable law or agreed to in writing, software
beierlme7646252022-01-13 10:53:08 -050011# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
calvinosanchbfb77902019-07-31 13:31:16 +000017
beierlmd7449362022-01-13 10:53:08 -050018FROM ubuntu:20.04 as INSTALL
David Garciaa60ec732021-03-17 15:28:47 +010019
beierlme7646252022-01-13 10:53:08 -050020ARG APT_PROXY
21RUN if [ ! -z $APT_PROXY ] ; then \
22 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
23 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
24 fi
25
David Garciaa60ec732021-03-17 15:28:47 +010026RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
27 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
beierlmd7449362022-01-13 10:53:08 -050028 gcc=4:9.3.* \
29 python3=3.8.* \
30 python3-dev=3.8.* \
31 python3-pip=20.0.2* \
32 python3-setuptools=45.2.* \
33 curl=7.68.*
34
35RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
36 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedufd164af2021-08-12 15:35:51 +010037 genisoimage=9:1.1.* \
beierlmd7449362022-01-13 10:53:08 -050038 netbase=6.*
David Garciaa60ec732021-03-17 15:28:47 +010039
David Garciaa60ec732021-03-17 15:28:47 +010040ARG PYTHON3_OSM_COMMON_URL
41ARG PYTHON3_OSM_NG_RO_URL
42ARG PYTHON3_OSM_RO_PLUGIN_URL
43ARG PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL
44ARG PYTHON3_OSM_ROSDN_DPB_URL
45ARG PYTHON3_OSM_ROSDN_DYNPAC_URL
46ARG PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL
47ARG PYTHON3_OSM_ROSDN_IETFL2VPN_URL
48ARG PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL
49ARG PYTHON3_OSM_ROSDN_ODLOF_URL
50ARG PYTHON3_OSM_ROSDN_ONOSOF_URL
51ARG PYTHON3_OSM_ROSDN_ONOS_VPLS_URL
52ARG PYTHON3_OSM_ROVIM_AWS_URL
53ARG PYTHON3_OSM_ROVIM_AZURE_URL
garciadeblasf854a612021-11-09 23:30:47 +010054ARG PYTHON3_OSM_ROVIM_GCP_URL
David Garciaa60ec732021-03-17 15:28:47 +010055ARG PYTHON3_OSM_ROVIM_OPENSTACK_URL
56ARG PYTHON3_OSM_ROVIM_OPENVIM_URL
57ARG PYTHON3_OSM_ROVIM_VMWARE_URL
58
59RUN for URL in \
60 $PYTHON3_OSM_COMMON_URL \
61 $PYTHON3_OSM_NG_RO_URL \
62 $PYTHON3_OSM_RO_PLUGIN_URL \
63 $PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL \
64 $PYTHON3_OSM_ROSDN_DPB_URL \
65 $PYTHON3_OSM_ROSDN_DYNPAC_URL \
66 $PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL \
67 $PYTHON3_OSM_ROSDN_IETFL2VPN_URL \
68 $PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL \
69 $PYTHON3_OSM_ROSDN_ODLOF_URL \
70 $PYTHON3_OSM_ROSDN_ONOSOF_URL \
71 $PYTHON3_OSM_ROSDN_ONOS_VPLS_URL \
72 $PYTHON3_OSM_ROVIM_AWS_URL \
73 $PYTHON3_OSM_ROVIM_AZURE_URL \
garciadeblasf854a612021-11-09 23:30:47 +010074 $PYTHON3_OSM_ROVIM_GCP_URL \
David Garciaa60ec732021-03-17 15:28:47 +010075 $PYTHON3_OSM_ROVIM_OPENSTACK_URL \
76 $PYTHON3_OSM_ROVIM_OPENVIM_URL \
77 $PYTHON3_OSM_ROVIM_VMWARE_URL ; do \
78 curl -s $URL -O ; \
79 done
80
81RUN dpkg -i *.deb
82
83RUN pip3 install \
84 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
85 -r /usr/lib/python3/dist-packages/osm_ng_ro/requirements.txt
86
beierlmd7449362022-01-13 10:53:08 -050087#######################################################################################
88FROM ubuntu:20.04 as FINAL
89
90ARG APT_PROXY
91RUN if [ ! -z $APT_PROXY ] ; then \
92 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
93 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
94 fi
Mike Marchetti182bd732018-09-05 09:52:42 -040095
David Garciaa60ec732021-03-17 15:28:47 +010096RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
beierlmd7449362022-01-13 10:53:08 -050097 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
98 python3-minimal=3.8.* \
garciadeblas6ba74b52021-09-23 17:43:15 +020099 && rm -rf /var/lib/apt/lists/*
Mike Marchetti182bd732018-09-05 09:52:42 -0400100
Mark Beierle5b9ba62022-09-08 05:44:06 -0400101RUN rm -f /etc/apt/apt.conf.d/proxy.conf
102
David Garciaa60ec732021-03-17 15:28:47 +0100103COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
beierlmd7449362022-01-13 10:53:08 -0500104COPY --from=INSTALL /usr/local/lib/python3.8/dist-packages /usr/local/lib/python3.8/dist-packages
David Garciaa60ec732021-03-17 15:28:47 +0100105COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage
sousaedue4b0c412021-04-08 15:57:59 +0200106COPY --from=INSTALL /etc/protocols /etc/protocols
Mike Marchetti182bd732018-09-05 09:52:42 -0400107
Mike Marchetti182bd732018-09-05 09:52:42 -0400108EXPOSE 9090
109
sousaedu0047e362021-10-14 03:55:25 +0100110# Creating the user for the app
111RUN groupadd -g 1000 appuser && \
112 useradd -u 1000 -g 1000 -d /app appuser && \
113 mkdir -p /app/osm_ro && \
114 mkdir -p /app/storage/kafka && \
115 mkdir /app/log && \
116 chown -R appuser:appuser /app
117
118WORKDIR /app/osm_ro
119
120# Changing the security context
121USER appuser
122
Mike Marchetti182bd732018-09-05 09:52:42 -0400123# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
124# These ENV must be provided
125ENV RO_DB_HOST=""
126ENV RO_DB_OVIM_HOST=""
127 # if empty RO_DB_HOST is assumed
128
129# These ENV should be provided first time for creating database. It will create and init only if empty!
130ENV RO_DB_ROOT_PASSWORD=""
131ENV RO_DB_OVIM_ROOT_PASSWORD=""
132 # if empty RO_DB_ROOT_PASSWORD is assumed
133
134# These ENV can be provided, but default values are ok
135ENV RO_DB_USER=mano
136ENV RO_DB_OVIM_USER=mano
137ENV RO_DB_PASSWORD=manopw
138ENV RO_DB_OVIM_PASSWORD=manopw
139ENV RO_DB_PORT=3306
140ENV RO_DB_OVIM_PORT=3306
141ENV RO_DB_NAME=mano_db
142ENV RO_DB_OVIM_NAME=mano_vim_db
tiernoc2e35792019-11-23 17:14:57 +0000143ENV OPENMANO_TENANT=osm
Mike Marchetti182bd732018-09-05 09:52:42 -0400144
tierno9ec1fe92020-11-25 13:16:51 +0000145# database
146ENV OSMRO_DATABASE_DRIVER mongo
147ENV OSMRO_DATABASE_URI mongodb://mongo:27017
148# ENV OSMRO_DATABASE_COMMONKEY xxx
149# ENV OSMRO_DATABASE_USER xxx
150# ENV OSMRO_DATABASE_PASSWORD xxx
151
152# message
153ENV OSMRO_MESSAGE_DRIVER kafka
154ENV OSMRO_MESSAGE_HOST kafka
155ENV OSMRO_MESSAGE_PORT 9092
156
157# logs
158ENV OSMRO_LOG_LEVEL INFO
159
tierno551c8942019-02-07 14:42:14 +0100160HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
tierno9ec1fe92020-11-25 13:16:51 +0000161 CMD curl --silent --fail http://localhost:9090/ro || exit 1
David Garciaa60ec732021-03-17 15:28:47 +0100162
sousaeduabdf1a72021-02-09 14:39:12 +0100163CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]