blob: 69d40b4e2aa2a984f000ea3c1d3add8c11bdc7ec [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
Mark Beierl02feb8e2023-05-10 11:44:11 -040018FROM ubuntu:22.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 \
Mark Beierl02feb8e2023-05-10 11:44:11 -040028 gcc=4:11.* \
29 python3=3.10.* \
30 python3-dev=3.10.* \
31 python3-pip=22.0.* \
32 curl=7.81.* \
33 && rm -rf /var/lib/apt/lists/*
34
35#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +020036# End of common preparation
beierlmd7449362022-01-13 10:53:08 -050037
38RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
39 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
sousaedufd164af2021-08-12 15:35:51 +010040 genisoimage=9:1.1.* \
uniyalnaee233332025-04-07 08:45:09 +000041 libmagic1 \
garciadeblas2fc3deb2025-11-25 17:26:14 +010042 netbase=6.* \
43 git
David Garciaa60ec732021-03-17 15:28:47 +010044
garciadeblas2fc3deb2025-11-25 17:26:14 +010045ARG COMMON_GERRIT_REFSPEC=master
46RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/common.git /tmp/osm-common && \
47 cd /tmp/osm-common && \
48 git fetch origin ${COMMON_GERRIT_REFSPEC} && \
49 git checkout FETCH_HEAD && \
50 cd - && \
51 pip install --no-cache-dir -r /tmp/osm-common/requirements.txt && \
52 pip install /tmp/osm-common
53
David Garciaa60ec732021-03-17 15:28:47 +010054ARG PYTHON3_OSM_NG_RO_URL
55ARG PYTHON3_OSM_RO_PLUGIN_URL
56ARG PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL
57ARG PYTHON3_OSM_ROSDN_DPB_URL
58ARG PYTHON3_OSM_ROSDN_DYNPAC_URL
59ARG PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL
60ARG PYTHON3_OSM_ROSDN_IETFL2VPN_URL
61ARG PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL
62ARG PYTHON3_OSM_ROSDN_ODLOF_URL
63ARG PYTHON3_OSM_ROSDN_ONOSOF_URL
64ARG PYTHON3_OSM_ROSDN_ONOS_VPLS_URL
65ARG PYTHON3_OSM_ROVIM_AWS_URL
66ARG PYTHON3_OSM_ROVIM_AZURE_URL
garciadeblasf854a612021-11-09 23:30:47 +010067ARG PYTHON3_OSM_ROVIM_GCP_URL
David Garciaa60ec732021-03-17 15:28:47 +010068ARG PYTHON3_OSM_ROVIM_OPENSTACK_URL
69ARG PYTHON3_OSM_ROVIM_OPENVIM_URL
uniyalnaee233332025-04-07 08:45:09 +000070ARG PYTHON3_OSM_ROVIM_VCENTER_URL
David Garciaa60ec732021-03-17 15:28:47 +010071ARG PYTHON3_OSM_ROVIM_VMWARE_URL
72
73RUN for URL in \
David Garciaa60ec732021-03-17 15:28:47 +010074 $PYTHON3_OSM_NG_RO_URL \
75 $PYTHON3_OSM_RO_PLUGIN_URL \
76 $PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL \
77 $PYTHON3_OSM_ROSDN_DPB_URL \
78 $PYTHON3_OSM_ROSDN_DYNPAC_URL \
79 $PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL \
80 $PYTHON3_OSM_ROSDN_IETFL2VPN_URL \
81 $PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL \
82 $PYTHON3_OSM_ROSDN_ODLOF_URL \
83 $PYTHON3_OSM_ROSDN_ONOSOF_URL \
84 $PYTHON3_OSM_ROSDN_ONOS_VPLS_URL \
85 $PYTHON3_OSM_ROVIM_AWS_URL \
86 $PYTHON3_OSM_ROVIM_AZURE_URL \
garciadeblasf854a612021-11-09 23:30:47 +010087 $PYTHON3_OSM_ROVIM_GCP_URL \
David Garciaa60ec732021-03-17 15:28:47 +010088 $PYTHON3_OSM_ROVIM_OPENSTACK_URL \
89 $PYTHON3_OSM_ROVIM_OPENVIM_URL \
uniyalnaee233332025-04-07 08:45:09 +000090 $PYTHON3_OSM_ROVIM_VCENTER_URL \
David Garciaa60ec732021-03-17 15:28:47 +010091 $PYTHON3_OSM_ROVIM_VMWARE_URL ; do \
92 curl -s $URL -O ; \
93 done
94
95RUN dpkg -i *.deb
96
97RUN pip3 install \
David Garciaa60ec732021-03-17 15:28:47 +010098 -r /usr/lib/python3/dist-packages/osm_ng_ro/requirements.txt
99
beierlmd7449362022-01-13 10:53:08 -0500100#######################################################################################
Mark Beierl02feb8e2023-05-10 11:44:11 -0400101#######################################################################################
102FROM ubuntu:22.04 as FINAL
beierlmd7449362022-01-13 10:53:08 -0500103
104ARG APT_PROXY
105RUN if [ ! -z $APT_PROXY ] ; then \
106 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
107 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
108 fi
Mike Marchetti182bd732018-09-05 09:52:42 -0400109
David Garciaa60ec732021-03-17 15:28:47 +0100110RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
beierlmd7449362022-01-13 10:53:08 -0500111 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Mark Beierl02feb8e2023-05-10 11:44:11 -0400112 python3-minimal=3.10.* \
garciadeblas6ba74b52021-09-23 17:43:15 +0200113 && rm -rf /var/lib/apt/lists/*
Mike Marchetti182bd732018-09-05 09:52:42 -0400114
Mark Beierl02feb8e2023-05-10 11:44:11 -0400115COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
116COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
117
118#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +0200119# End of common preparation
Mark Beierl02feb8e2023-05-10 11:44:11 -0400120
Mark Beierle5b9ba62022-09-08 05:44:06 -0400121RUN rm -f /etc/apt/apt.conf.d/proxy.conf
122
David Garciaa60ec732021-03-17 15:28:47 +0100123COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage
sousaedue4b0c412021-04-08 15:57:59 +0200124COPY --from=INSTALL /etc/protocols /etc/protocols
Mike Marchetti182bd732018-09-05 09:52:42 -0400125
uniyalnaee233332025-04-07 08:45:09 +0000126# Copy libmagic.so.1 and dependencies
127COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1 /usr/lib/x86_64-linux-gnu/
128COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1.* /usr/lib/x86_64-linux-gnu/
129COPY --from=INSTALL /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc
130
Mike Marchetti182bd732018-09-05 09:52:42 -0400131EXPOSE 9090
132
sousaedu0047e362021-10-14 03:55:25 +0100133# Creating the user for the app
134RUN groupadd -g 1000 appuser && \
135 useradd -u 1000 -g 1000 -d /app appuser && \
136 mkdir -p /app/osm_ro && \
137 mkdir -p /app/storage/kafka && \
138 mkdir /app/log && \
139 chown -R appuser:appuser /app
140
141WORKDIR /app/osm_ro
142
143# Changing the security context
144USER appuser
145
Mike Marchetti182bd732018-09-05 09:52:42 -0400146# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
147# These ENV must be provided
148ENV RO_DB_HOST=""
149ENV RO_DB_OVIM_HOST=""
150 # if empty RO_DB_HOST is assumed
151
152# These ENV should be provided first time for creating database. It will create and init only if empty!
153ENV RO_DB_ROOT_PASSWORD=""
154ENV RO_DB_OVIM_ROOT_PASSWORD=""
155 # if empty RO_DB_ROOT_PASSWORD is assumed
156
157# These ENV can be provided, but default values are ok
158ENV RO_DB_USER=mano
159ENV RO_DB_OVIM_USER=mano
160ENV RO_DB_PASSWORD=manopw
161ENV RO_DB_OVIM_PASSWORD=manopw
162ENV RO_DB_PORT=3306
163ENV RO_DB_OVIM_PORT=3306
164ENV RO_DB_NAME=mano_db
165ENV RO_DB_OVIM_NAME=mano_vim_db
tiernoc2e35792019-11-23 17:14:57 +0000166ENV OPENMANO_TENANT=osm
Mike Marchetti182bd732018-09-05 09:52:42 -0400167
tierno9ec1fe92020-11-25 13:16:51 +0000168# database
169ENV OSMRO_DATABASE_DRIVER mongo
170ENV OSMRO_DATABASE_URI mongodb://mongo:27017
171# ENV OSMRO_DATABASE_COMMONKEY xxx
172# ENV OSMRO_DATABASE_USER xxx
173# ENV OSMRO_DATABASE_PASSWORD xxx
174
175# message
176ENV OSMRO_MESSAGE_DRIVER kafka
177ENV OSMRO_MESSAGE_HOST kafka
178ENV OSMRO_MESSAGE_PORT 9092
179
180# logs
181ENV OSMRO_LOG_LEVEL INFO
182
tierno551c8942019-02-07 14:42:14 +0100183HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
tierno9ec1fe92020-11-25 13:16:51 +0000184 CMD curl --silent --fail http://localhost:9090/ro || exit 1
David Garciaa60ec732021-03-17 15:28:47 +0100185
sousaeduabdf1a72021-02-09 14:39:12 +0100186CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]