blob: dde5261c3e669bd643f555ca0ae5c82b3d35eb1e [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
garciadeblas87a45b72025-12-09 20:01:03 +010046RUN pip3 install -U pip build
garciadeblas2fc3deb2025-11-25 17:26:14 +010047RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/common.git /tmp/osm-common && \
48 cd /tmp/osm-common && \
49 git fetch origin ${COMMON_GERRIT_REFSPEC} && \
50 git checkout FETCH_HEAD && \
51 cd - && \
garciadeblas87a45b72025-12-09 20:01:03 +010052 pip3 install --no-cache-dir -r /tmp/osm-common/requirements.txt && \
53 pip3 install /tmp/osm-common
garciadeblas2fc3deb2025-11-25 17:26:14 +010054
David Garciaa60ec732021-03-17 15:28:47 +010055ARG PYTHON3_OSM_NG_RO_URL
56ARG PYTHON3_OSM_RO_PLUGIN_URL
57ARG PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL
58ARG PYTHON3_OSM_ROSDN_DPB_URL
59ARG PYTHON3_OSM_ROSDN_DYNPAC_URL
60ARG PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL
61ARG PYTHON3_OSM_ROSDN_IETFL2VPN_URL
62ARG PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL
63ARG PYTHON3_OSM_ROSDN_ODLOF_URL
64ARG PYTHON3_OSM_ROSDN_ONOSOF_URL
65ARG PYTHON3_OSM_ROSDN_ONOS_VPLS_URL
66ARG PYTHON3_OSM_ROVIM_AWS_URL
67ARG PYTHON3_OSM_ROVIM_AZURE_URL
garciadeblasf854a612021-11-09 23:30:47 +010068ARG PYTHON3_OSM_ROVIM_GCP_URL
David Garciaa60ec732021-03-17 15:28:47 +010069ARG PYTHON3_OSM_ROVIM_OPENSTACK_URL
70ARG PYTHON3_OSM_ROVIM_OPENVIM_URL
uniyalnaee233332025-04-07 08:45:09 +000071ARG PYTHON3_OSM_ROVIM_VCENTER_URL
David Garciaa60ec732021-03-17 15:28:47 +010072ARG PYTHON3_OSM_ROVIM_VMWARE_URL
73
74RUN for URL in \
David Garciaa60ec732021-03-17 15:28:47 +010075 $PYTHON3_OSM_NG_RO_URL \
76 $PYTHON3_OSM_RO_PLUGIN_URL \
77 $PYTHON3_OSM_ROSDN_ARISTA_CLOUDVISION_URL \
78 $PYTHON3_OSM_ROSDN_DPB_URL \
79 $PYTHON3_OSM_ROSDN_DYNPAC_URL \
80 $PYTHON3_OSM_ROSDN_FLOODLIGHTOF_URL \
81 $PYTHON3_OSM_ROSDN_IETFL2VPN_URL \
82 $PYTHON3_OSM_ROSDN_JUNIPER_CONTRAIL_URL \
83 $PYTHON3_OSM_ROSDN_ODLOF_URL \
84 $PYTHON3_OSM_ROSDN_ONOSOF_URL \
85 $PYTHON3_OSM_ROSDN_ONOS_VPLS_URL \
86 $PYTHON3_OSM_ROVIM_AWS_URL \
87 $PYTHON3_OSM_ROVIM_AZURE_URL \
garciadeblasf854a612021-11-09 23:30:47 +010088 $PYTHON3_OSM_ROVIM_GCP_URL \
David Garciaa60ec732021-03-17 15:28:47 +010089 $PYTHON3_OSM_ROVIM_OPENSTACK_URL \
90 $PYTHON3_OSM_ROVIM_OPENVIM_URL \
uniyalnaee233332025-04-07 08:45:09 +000091 $PYTHON3_OSM_ROVIM_VCENTER_URL \
David Garciaa60ec732021-03-17 15:28:47 +010092 $PYTHON3_OSM_ROVIM_VMWARE_URL ; do \
93 curl -s $URL -O ; \
94 done
95
96RUN dpkg -i *.deb
97
98RUN pip3 install \
David Garciaa60ec732021-03-17 15:28:47 +010099 -r /usr/lib/python3/dist-packages/osm_ng_ro/requirements.txt
100
beierlmd7449362022-01-13 10:53:08 -0500101#######################################################################################
Mark Beierl02feb8e2023-05-10 11:44:11 -0400102#######################################################################################
103FROM ubuntu:22.04 as FINAL
beierlmd7449362022-01-13 10:53:08 -0500104
105ARG APT_PROXY
106RUN if [ ! -z $APT_PROXY ] ; then \
107 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
108 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
109 fi
Mike Marchetti182bd732018-09-05 09:52:42 -0400110
David Garciaa60ec732021-03-17 15:28:47 +0100111RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
beierlmd7449362022-01-13 10:53:08 -0500112 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Mark Beierl02feb8e2023-05-10 11:44:11 -0400113 python3-minimal=3.10.* \
garciadeblas6ba74b52021-09-23 17:43:15 +0200114 && rm -rf /var/lib/apt/lists/*
Mike Marchetti182bd732018-09-05 09:52:42 -0400115
Mark Beierl02feb8e2023-05-10 11:44:11 -0400116COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
117COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
118
119#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +0200120# End of common preparation
Mark Beierl02feb8e2023-05-10 11:44:11 -0400121
Mark Beierle5b9ba62022-09-08 05:44:06 -0400122RUN rm -f /etc/apt/apt.conf.d/proxy.conf
123
David Garciaa60ec732021-03-17 15:28:47 +0100124COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage
sousaedue4b0c412021-04-08 15:57:59 +0200125COPY --from=INSTALL /etc/protocols /etc/protocols
Mike Marchetti182bd732018-09-05 09:52:42 -0400126
uniyalnaee233332025-04-07 08:45:09 +0000127# Copy libmagic.so.1 and dependencies
128COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1 /usr/lib/x86_64-linux-gnu/
129COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1.* /usr/lib/x86_64-linux-gnu/
130COPY --from=INSTALL /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc
131
Mike Marchetti182bd732018-09-05 09:52:42 -0400132EXPOSE 9090
133
sousaedu0047e362021-10-14 03:55:25 +0100134# Creating the user for the app
135RUN groupadd -g 1000 appuser && \
136 useradd -u 1000 -g 1000 -d /app appuser && \
137 mkdir -p /app/osm_ro && \
138 mkdir -p /app/storage/kafka && \
139 mkdir /app/log && \
140 chown -R appuser:appuser /app
141
142WORKDIR /app/osm_ro
143
144# Changing the security context
145USER appuser
146
Mike Marchetti182bd732018-09-05 09:52:42 -0400147# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
148# These ENV must be provided
149ENV RO_DB_HOST=""
150ENV RO_DB_OVIM_HOST=""
151 # if empty RO_DB_HOST is assumed
152
153# These ENV should be provided first time for creating database. It will create and init only if empty!
154ENV RO_DB_ROOT_PASSWORD=""
155ENV RO_DB_OVIM_ROOT_PASSWORD=""
156 # if empty RO_DB_ROOT_PASSWORD is assumed
157
158# These ENV can be provided, but default values are ok
159ENV RO_DB_USER=mano
160ENV RO_DB_OVIM_USER=mano
161ENV RO_DB_PASSWORD=manopw
162ENV RO_DB_OVIM_PASSWORD=manopw
163ENV RO_DB_PORT=3306
164ENV RO_DB_OVIM_PORT=3306
165ENV RO_DB_NAME=mano_db
166ENV RO_DB_OVIM_NAME=mano_vim_db
tiernoc2e35792019-11-23 17:14:57 +0000167ENV OPENMANO_TENANT=osm
Mike Marchetti182bd732018-09-05 09:52:42 -0400168
tierno9ec1fe92020-11-25 13:16:51 +0000169# database
170ENV OSMRO_DATABASE_DRIVER mongo
171ENV OSMRO_DATABASE_URI mongodb://mongo:27017
172# ENV OSMRO_DATABASE_COMMONKEY xxx
173# ENV OSMRO_DATABASE_USER xxx
174# ENV OSMRO_DATABASE_PASSWORD xxx
175
176# message
177ENV OSMRO_MESSAGE_DRIVER kafka
178ENV OSMRO_MESSAGE_HOST kafka
179ENV OSMRO_MESSAGE_PORT 9092
180
181# logs
182ENV OSMRO_LOG_LEVEL INFO
183
tierno551c8942019-02-07 14:42:14 +0100184HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
tierno9ec1fe92020-11-25 13:16:51 +0000185 CMD curl --silent --fail http://localhost:9090/ro || exit 1
David Garciaa60ec732021-03-17 15:28:47 +0100186
sousaeduabdf1a72021-02-09 14:39:12 +0100187CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]