blob: b3ebca3fa8535c084c59a99b12132966e6404c57 [file] [log] [blame]
sousaedu2cf9ebb2021-04-08 11:53:34 +02001############################################################################
2# Copyright 2021 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
gaticibcb71eb2023-07-28 14:31:49 +030017FROM ubuntu:22.04 as INSTALL
sousaedu2cf9ebb2021-04-08 11:53:34 +020018
19WORKDIR /build
20
21RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
22 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
23 gcc python3 python3-dev python3-venv python3-pip \
lloretgalleg6af6f6d2025-03-04 11:37:14 +000024 python3-setuptools curl git genisoimage netbase libmagic1 file && \
25 apt-get clean && rm -rf /var/lib/apt/lists/*
26
27# Upgrade pip and install build tools
28RUN python3 -m pip install -U pip build
sousaedu2cf9ebb2021-04-08 11:53:34 +020029
30COPY . /build
31
32RUN git clone https://osm.etsi.org/gerrit/osm/common.git
33
34RUN python3 -m pip install -r requirements.txt \
35 -r common/requirements.txt
36
37RUN python3 -m build /build/common && \
38 python3 -m pip install /build/common/dist/*.whl
39
40RUN python3 -m build /build/RO-plugin && \
41 python3 -m pip install /build/RO-plugin/dist/*.whl
42
43RUN python3 -m build /build/NG-RO && \
44 python3 -m pip install /build/NG-RO/dist/*.whl
45
46RUN python3 -m build /build/RO-VIM-vmware && \
47 python3 -m pip install /build/RO-VIM-vmware/dist/*.whl
48
49RUN python3 -m build /build/RO-VIM-openstack && \
50 python3 -m pip install /build/RO-VIM-openstack/dist/*.whl
51
lloretgalleg6af6f6d2025-03-04 11:37:14 +000052RUN python3 -m build /build/RO-VIM-vcenter && \
53 python3 -m pip install /build/RO-VIM-vcenter/dist/*.whl
54
sousaedu2cf9ebb2021-04-08 11:53:34 +020055RUN python3 -m build /build/RO-VIM-openvim && \
56 python3 -m pip install /build/RO-VIM-openvim/dist/*.whl
57
58RUN python3 -m build /build/RO-VIM-aws && \
59 python3 -m pip install /build/RO-VIM-aws/dist/*.whl
60
61RUN python3 -m build /build/RO-VIM-azure && \
62 python3 -m pip install /build/RO-VIM-azure/dist/*.whl
63
sousaedu2cf9ebb2021-04-08 11:53:34 +020064RUN python3 -m build /build/RO-SDN-dynpac && \
65 python3 -m pip install /build/RO-SDN-dynpac/dist/*.whl
66
67RUN python3 -m build /build/RO-SDN-ietfl2vpn && \
68 python3 -m pip install /build/RO-SDN-ietfl2vpn/dist/*.whl
69
70RUN python3 -m build /build/RO-SDN-onos_vpls && \
71 python3 -m pip install /build/RO-SDN-onos_vpls/dist/*.whl
72
73RUN python3 -m build /build/RO-SDN-onos_openflow && \
74 python3 -m pip install /build/RO-SDN-onos_openflow/dist/*.whl
75
76RUN python3 -m build /build/RO-SDN-odl_openflow && \
77 python3 -m pip install /build/RO-SDN-odl_openflow/dist/*.whl
78
79RUN python3 -m build /build/RO-SDN-floodlight_openflow && \
80 python3 -m pip install /build/RO-SDN-floodlight_openflow/dist/*.whl
81
82RUN python3 -m build /build/RO-SDN-arista_cloudvision && \
83 python3 -m pip install /build/RO-SDN-arista_cloudvision/dist/*.whl
84
85RUN python3 -m build /build/RO-SDN-juniper_contrail && \
86 python3 -m pip install /build/RO-SDN-juniper_contrail/dist/*.whl
87
gallardo34aa3a92021-10-08 11:50:00 +000088RUN python3 -m build /build/RO-VIM-gcp && \
89 python3 -m pip install /build/RO-VIM-gcp/dist/*.whl
90
gifrerenom0e517792023-04-18 16:38:42 +000091RUN python3 -m build /build/RO-SDN-tapi && \
92 python3 -m pip install /build/RO-SDN-tapi/dist/*.whl
93
gaticibcb71eb2023-07-28 14:31:49 +030094FROM ubuntu:22.04
sousaedu2cf9ebb2021-04-08 11:53:34 +020095
96RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
97 DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal
98
99COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
gaticibcb71eb2023-07-28 14:31:49 +0300100COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
sousaedu2cf9ebb2021-04-08 11:53:34 +0200101COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage
102COPY --from=INSTALL /etc/protocols /etc/protocols
103
lloretgalleg6af6f6d2025-03-04 11:37:14 +0000104# Copy libmagic.so.1 and dependencies
105COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1 /usr/lib/x86_64-linux-gnu/
106COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1.* /usr/lib/x86_64-linux-gnu/
107COPY --from=INSTALL /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc
108
sousaedu2cf9ebb2021-04-08 11:53:34 +0200109VOLUME /var/log/osm
110
111EXPOSE 9090
112
gaticibcb71eb2023-07-28 14:31:49 +0300113# Creating the user for the app
114RUN groupadd -g 1000 appuser && \
115 useradd -u 1000 -g 1000 -d /app appuser && \
116 mkdir -p /app/osm_ro && \
117 mkdir -p /app/storage/kafka && \
118 mkdir /app/log && \
119 chown -R appuser:appuser /app
120
121WORKDIR /app/osm_ro
122
123# Changing the security context
124USER appuser
125
sousaedu2cf9ebb2021-04-08 11:53:34 +0200126# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
127# These ENV must be provided
128ENV RO_DB_HOST=""
129ENV RO_DB_OVIM_HOST=""
130 # if empty RO_DB_HOST is assumed
131
132# These ENV should be provided first time for creating database. It will create and init only if empty!
133ENV RO_DB_ROOT_PASSWORD=""
134ENV RO_DB_OVIM_ROOT_PASSWORD=""
135 # if empty RO_DB_ROOT_PASSWORD is assumed
136
137# These ENV can be provided, but default values are ok
138ENV RO_DB_USER=mano
139ENV RO_DB_OVIM_USER=mano
140ENV RO_DB_PASSWORD=manopw
141ENV RO_DB_OVIM_PASSWORD=manopw
142ENV RO_DB_PORT=3306
143ENV RO_DB_OVIM_PORT=3306
144ENV RO_DB_NAME=mano_db
145ENV RO_DB_OVIM_NAME=mano_vim_db
146ENV OPENMANO_TENANT=osm
147
148# database
149ENV OSMRO_DATABASE_DRIVER mongo
150ENV OSMRO_DATABASE_URI mongodb://mongo:27017
151# ENV OSMRO_DATABASE_COMMONKEY xxx
152# ENV OSMRO_DATABASE_USER xxx
153# ENV OSMRO_DATABASE_PASSWORD xxx
154
155# message
156ENV OSMRO_MESSAGE_DRIVER kafka
157ENV OSMRO_MESSAGE_HOST kafka
158ENV OSMRO_MESSAGE_PORT 9092
159
160# logs
161ENV OSMRO_LOG_LEVEL INFO
162
163CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]