| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 1 | ############################################################################ |
| 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 | |
| gatici | bcb71eb | 2023-07-28 14:31:49 +0300 | [diff] [blame] | 17 | FROM ubuntu:22.04 as INSTALL |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 18 | |
| 19 | WORKDIR /build |
| 20 | |
| 21 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 22 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| 23 | gcc python3 python3-dev python3-venv python3-pip \ |
| lloretgalleg | 6af6f6d | 2025-03-04 11:37:14 +0000 | [diff] [blame] | 24 | 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 |
| 28 | RUN python3 -m pip install -U pip build |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 29 | |
| 30 | COPY . /build |
| 31 | |
| 32 | RUN git clone https://osm.etsi.org/gerrit/osm/common.git |
| 33 | |
| 34 | RUN python3 -m pip install -r requirements.txt \ |
| 35 | -r common/requirements.txt |
| 36 | |
| 37 | RUN python3 -m build /build/common && \ |
| 38 | python3 -m pip install /build/common/dist/*.whl |
| 39 | |
| 40 | RUN python3 -m build /build/RO-plugin && \ |
| 41 | python3 -m pip install /build/RO-plugin/dist/*.whl |
| 42 | |
| 43 | RUN python3 -m build /build/NG-RO && \ |
| 44 | python3 -m pip install /build/NG-RO/dist/*.whl |
| 45 | |
| 46 | RUN python3 -m build /build/RO-VIM-vmware && \ |
| 47 | python3 -m pip install /build/RO-VIM-vmware/dist/*.whl |
| 48 | |
| 49 | RUN python3 -m build /build/RO-VIM-openstack && \ |
| 50 | python3 -m pip install /build/RO-VIM-openstack/dist/*.whl |
| 51 | |
| lloretgalleg | 6af6f6d | 2025-03-04 11:37:14 +0000 | [diff] [blame] | 52 | RUN python3 -m build /build/RO-VIM-vcenter && \ |
| 53 | python3 -m pip install /build/RO-VIM-vcenter/dist/*.whl |
| 54 | |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 55 | RUN python3 -m build /build/RO-VIM-openvim && \ |
| 56 | python3 -m pip install /build/RO-VIM-openvim/dist/*.whl |
| 57 | |
| 58 | RUN python3 -m build /build/RO-VIM-aws && \ |
| 59 | python3 -m pip install /build/RO-VIM-aws/dist/*.whl |
| 60 | |
| 61 | RUN python3 -m build /build/RO-VIM-azure && \ |
| 62 | python3 -m pip install /build/RO-VIM-azure/dist/*.whl |
| 63 | |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 64 | RUN python3 -m build /build/RO-SDN-dynpac && \ |
| 65 | python3 -m pip install /build/RO-SDN-dynpac/dist/*.whl |
| 66 | |
| 67 | RUN python3 -m build /build/RO-SDN-ietfl2vpn && \ |
| 68 | python3 -m pip install /build/RO-SDN-ietfl2vpn/dist/*.whl |
| 69 | |
| 70 | RUN python3 -m build /build/RO-SDN-onos_vpls && \ |
| 71 | python3 -m pip install /build/RO-SDN-onos_vpls/dist/*.whl |
| 72 | |
| 73 | RUN python3 -m build /build/RO-SDN-onos_openflow && \ |
| 74 | python3 -m pip install /build/RO-SDN-onos_openflow/dist/*.whl |
| 75 | |
| 76 | RUN python3 -m build /build/RO-SDN-odl_openflow && \ |
| 77 | python3 -m pip install /build/RO-SDN-odl_openflow/dist/*.whl |
| 78 | |
| 79 | RUN python3 -m build /build/RO-SDN-floodlight_openflow && \ |
| 80 | python3 -m pip install /build/RO-SDN-floodlight_openflow/dist/*.whl |
| 81 | |
| 82 | RUN python3 -m build /build/RO-SDN-arista_cloudvision && \ |
| 83 | python3 -m pip install /build/RO-SDN-arista_cloudvision/dist/*.whl |
| 84 | |
| 85 | RUN python3 -m build /build/RO-SDN-juniper_contrail && \ |
| 86 | python3 -m pip install /build/RO-SDN-juniper_contrail/dist/*.whl |
| 87 | |
| gallardo | 34aa3a9 | 2021-10-08 11:50:00 +0000 | [diff] [blame] | 88 | RUN python3 -m build /build/RO-VIM-gcp && \ |
| 89 | python3 -m pip install /build/RO-VIM-gcp/dist/*.whl |
| 90 | |
| gifrerenom | 0e51779 | 2023-04-18 16:38:42 +0000 | [diff] [blame] | 91 | RUN python3 -m build /build/RO-SDN-tapi && \ |
| 92 | python3 -m pip install /build/RO-SDN-tapi/dist/*.whl |
| 93 | |
| gatici | bcb71eb | 2023-07-28 14:31:49 +0300 | [diff] [blame] | 94 | FROM ubuntu:22.04 |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 95 | |
| 96 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 97 | DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal |
| 98 | |
| 99 | COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages |
| gatici | bcb71eb | 2023-07-28 14:31:49 +0300 | [diff] [blame] | 100 | COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 101 | COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage |
| 102 | COPY --from=INSTALL /etc/protocols /etc/protocols |
| 103 | |
| lloretgalleg | 6af6f6d | 2025-03-04 11:37:14 +0000 | [diff] [blame] | 104 | # Copy libmagic.so.1 and dependencies |
| 105 | COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1 /usr/lib/x86_64-linux-gnu/ |
| 106 | COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/libmagic.so.1.* /usr/lib/x86_64-linux-gnu/ |
| 107 | COPY --from=INSTALL /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc |
| 108 | |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 109 | VOLUME /var/log/osm |
| 110 | |
| 111 | EXPOSE 9090 |
| 112 | |
| gatici | bcb71eb | 2023-07-28 14:31:49 +0300 | [diff] [blame] | 113 | # Creating the user for the app |
| 114 | RUN 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 | |
| 121 | WORKDIR /app/osm_ro |
| 122 | |
| 123 | # Changing the security context |
| 124 | USER appuser |
| 125 | |
| sousaedu | 2cf9ebb | 2021-04-08 11:53:34 +0200 | [diff] [blame] | 126 | # Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers |
| 127 | # These ENV must be provided |
| 128 | ENV RO_DB_HOST="" |
| 129 | ENV 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! |
| 133 | ENV RO_DB_ROOT_PASSWORD="" |
| 134 | ENV 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 |
| 138 | ENV RO_DB_USER=mano |
| 139 | ENV RO_DB_OVIM_USER=mano |
| 140 | ENV RO_DB_PASSWORD=manopw |
| 141 | ENV RO_DB_OVIM_PASSWORD=manopw |
| 142 | ENV RO_DB_PORT=3306 |
| 143 | ENV RO_DB_OVIM_PORT=3306 |
| 144 | ENV RO_DB_NAME=mano_db |
| 145 | ENV RO_DB_OVIM_NAME=mano_vim_db |
| 146 | ENV OPENMANO_TENANT=osm |
| 147 | |
| 148 | # database |
| 149 | ENV OSMRO_DATABASE_DRIVER mongo |
| 150 | ENV 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 |
| 156 | ENV OSMRO_MESSAGE_DRIVER kafka |
| 157 | ENV OSMRO_MESSAGE_HOST kafka |
| 158 | ENV OSMRO_MESSAGE_PORT 9092 |
| 159 | |
| 160 | # logs |
| 161 | ENV OSMRO_LOG_LEVEL INFO |
| 162 | |
| 163 | CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"] |