| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 1 | ## |
| 2 | # Copyright ETSI |
| tierno | d125caf | 2018-11-22 16:05:54 +0000 | [diff] [blame] | 3 | # |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 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 |
| tierno | d125caf | 2018-11-22 16:05:54 +0000 | [diff] [blame] | 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 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 | ## |
| tierno | d125caf | 2018-11-22 16:05:54 +0000 | [diff] [blame] | 16 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 17 | ######################################################################## |
| tierno | a8d6363 | 2018-05-10 13:12:32 +0200 | [diff] [blame] | 18 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 19 | FROM ubuntu:18.04 as INSTALL |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 20 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 21 | WORKDIR /build |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 22 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 23 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 24 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| 25 | gcc git python3 python3-dev python3-venv python3-pip \ |
| 26 | python3-setuptools wget && \ |
| 27 | python3 -m pip install -U pip build |
| calvinosanch | 675b804 | 2020-01-09 16:10:12 +0100 | [diff] [blame] | 28 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 29 | COPY . /build |
| tierno | aae4dc4 | 2018-06-11 18:55:50 +0200 | [diff] [blame] | 30 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 31 | RUN git clone https://osm.etsi.org/gerrit/osm/common.git |
| 32 | RUN git clone https://osm.etsi.org/gerrit/osm/IM.git |
| tierno | a8d6363 | 2018-05-10 13:12:32 +0200 | [diff] [blame] | 33 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 34 | RUN python3 -m pip install \ |
| 35 | -r requirements.txt \ |
| 36 | -r common/requirements.txt \ |
| 37 | -r IM/requirements.txt |
| 38 | |
| 39 | RUN python3 -m build /build/common && \ |
| 40 | python3 -m pip install /build/common/dist/*.whl |
| 41 | |
| 42 | RUN python3 -m build /build/IM && \ |
| 43 | python3 -m pip install /build/IM/dist/*.whl |
| 44 | |
| 45 | RUN python3 -m build /build && \ |
| 46 | python3 -m pip install /build/dist/*.whl |
| 47 | |
| 48 | |
| 49 | FROM ubuntu:18.04 as FINAL |
| 50 | |
| 51 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 52 | DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal |
| 53 | |
| 54 | COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages |
| 55 | COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages |
| 56 | |
| 57 | RUN mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 58 | |
| 59 | WORKDIR /app/osm_nbi |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 60 | |
| 61 | EXPOSE 9999 |
| 62 | |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 63 | RUN cp -R /usr/local/lib/python3.6/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public |
| 64 | RUN cp /usr/local/lib/python3.6/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/ |
| 65 | RUN cp -R /usr/local/lib/python3.6/dist-packages/osm_nbi/http /app/osm_nbi/ |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 66 | |
| 67 | # Used for local storage |
| 68 | VOLUME /app/storage |
| 69 | # Used for logs |
| 70 | VOLUME /app/log |
| 71 | |
| 72 | # The following ENV can be added with "docker run -e xxx' to configure |
| 73 | # server |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 74 | ENV OSMNBI_SOCKET_HOST 0.0.0.0 |
| 75 | ENV OSMNBI_SOCKET_PORT 9999 |
| 76 | ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/osm_nbi/http/cert.pem |
| 77 | ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/osm_nbi/http/privkey.pem |
| 78 | |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 79 | # storage |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 80 | ENV OSMNBI_STORAGE_PATH /app/storage |
| 81 | |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 82 | # database |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 83 | ENV OSMNBI_DATABASE_DRIVER mongo |
| 84 | ENV OSMNBI_DATABASE_URI mongodb://mongo:27017 |
| 85 | #ENV OSMNBI_DATABASE_HOST mongo |
| 86 | #ENV OSMNBI_DATABASE_PORT 27017 |
| 87 | |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 88 | # web |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 89 | ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public |
| tierno | 4836bac | 2020-01-15 14:41:48 +0000 | [diff] [blame] | 90 | |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 91 | # message |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 92 | ENV OSMNBI_MESSAGE_DRIVER kafka |
| 93 | ENV OSMNBI_MESSAGE_HOST kafka |
| 94 | ENV OSMNBI_MESSAGE_PORT 9092 |
| 95 | |
| 96 | # logs |
| 97 | ENV OSMNBI_LOG_FILE /app/log/nbi.log |
| 98 | ENV OSMNBI_LOG_LEVEL DEBUG |
| 99 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 100 | # authentication |
| 101 | ENV OSMNBI_AUTHENTICATION_BACKEND internal |
| 102 | #ENV OSMNBI_AUTHENTICATION_BACKEND keystone |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 103 | #ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 104 | #ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000 |
| 105 | #ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default |
| 106 | #ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default |
| 107 | #ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi |
| 108 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi |
| 109 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 110 | |
| 111 | #prometheus |
| vijay.r | 35ef2f7 | 2019-04-30 17:55:49 +0530 | [diff] [blame] | 112 | ENV OSMNBI_PROMETHEUS_HOST prometheus |
| 113 | ENV OSMNBI_PROMETHEUS_PORT 9090 |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 114 | |
| Mike Marchetti | c678d04 | 2018-04-18 13:51:27 -0400 | [diff] [blame] | 115 | # Run app.py when the container launches |
| beierlm | 2663b79 | 2021-02-22 14:30:35 -0500 | [diff] [blame] | 116 | CMD ["python3", "-u", "-m", "osm_nbi.nbi"] |