| beierlm | e764625 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 1 | ####################################################################################### |
| 2 | # Copyright ETSI Contributors and Others. |
| 3 | # |
| 4 | # 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 |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 10 | # Unless required by applicable law or agreed to in writing, software |
| beierlm | e764625 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 11 | # 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 | ####################################################################################### |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 17 | |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 18 | FROM ubuntu:22.04 as INSTALL |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 19 | |
| beierlm | e764625 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 20 | ARG APT_PROXY |
| 21 | RUN 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 Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 26 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 27 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 28 | 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 | ####################################################################################### |
| garciadeblas | 21503ab | 2023-06-28 14:31:27 +0200 | [diff] [blame] | 36 | # End of common preparation |
| beierlm | d744936 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 37 | |
| garciadeblas | 1028530 | 2022-02-10 00:49:51 +0100 | [diff] [blame] | 38 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 39 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| garciadeblas | 2fc3deb | 2025-11-25 17:26:14 +0100 | [diff] [blame^] | 40 | openssh-client=1:8.* git |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 41 | |
| garciadeblas | 2fc3deb | 2025-11-25 17:26:14 +0100 | [diff] [blame^] | 42 | ARG COMMON_GERRIT_REFSPEC=master |
| 43 | RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/common.git /tmp/osm-common && \ |
| 44 | cd /tmp/osm-common && \ |
| 45 | git fetch origin ${COMMON_GERRIT_REFSPEC} && \ |
| 46 | git checkout FETCH_HEAD && \ |
| 47 | cd - && \ |
| 48 | pip install --no-cache-dir -r /tmp/osm-common/requirements.txt && \ |
| 49 | pip install /tmp/osm-common |
| 50 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 51 | ARG PYTHON3_OSM_MON_URL |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 52 | RUN curl $PYTHON3_OSM_MON_URL -o osm_mon.deb |
| 53 | RUN dpkg -i ./osm_mon.deb |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 54 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 55 | RUN pip3 install \ |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 56 | -r /usr/lib/python3/dist-packages/osm_mon/requirements.txt |
| Felipe Vicens | ce8b5a4 | 2019-11-30 19:35:52 +0100 | [diff] [blame] | 57 | |
| beierlm | d744936 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 58 | ####################################################################################### |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 59 | ####################################################################################### |
| 60 | FROM ubuntu:22.04 as FINAL |
| Felipe Vicens | ce8b5a4 | 2019-11-30 19:35:52 +0100 | [diff] [blame] | 61 | |
| beierlm | d744936 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 62 | ARG APT_PROXY |
| 63 | RUN if [ ! -z $APT_PROXY ] ; then \ |
| 64 | echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\ |
| 65 | echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\ |
| 66 | fi |
| 67 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 68 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| garciadeblas | 15897d6 | 2021-09-22 18:11:54 +0200 | [diff] [blame] | 69 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 70 | python3-minimal=3.10.* \ |
| beierlm | d744936 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 71 | && rm -rf /var/lib/apt/lists/* |
| 72 | |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 73 | COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages |
| 74 | COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages |
| 75 | |
| 76 | ####################################################################################### |
| garciadeblas | 21503ab | 2023-06-28 14:31:27 +0200 | [diff] [blame] | 77 | # End of common preparation |
| Mark Beierl | 02feb8e | 2023-05-10 11:44:11 -0400 | [diff] [blame] | 78 | |
| beierlm | d744936 | 2022-01-13 10:53:08 -0500 | [diff] [blame] | 79 | RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ |
| 80 | DEBIAN_FRONTEND=noninteractive apt-get --yes install \ |
| garciadeblas | 6ba74b5 | 2021-09-23 17:43:15 +0200 | [diff] [blame] | 81 | ca-certificates \ |
| 82 | && rm -rf /var/lib/apt/lists/* |
| beierlm | 023e83c | 2021-04-14 10:12:58 -0400 | [diff] [blame] | 83 | |
| Mark Beierl | e5b9ba6 | 2022-09-08 05:44:06 -0400 | [diff] [blame] | 84 | RUN rm -f /etc/apt/apt.conf.d/proxy.conf |
| 85 | |
| David Garcia | a60ec73 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 86 | COPY --from=INSTALL /usr/bin/osm* /usr/bin/ |
| beierlm | 023e83c | 2021-04-14 10:12:58 -0400 | [diff] [blame] | 87 | COPY --from=INSTALL /usr/bin/scp /usr/bin/scp |
| 88 | COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen |
| 89 | COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh |
| 90 | COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ |
| 91 | COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/ |
| Felipe Vicens | ce8b5a4 | 2019-11-30 19:35:52 +0100 | [diff] [blame] | 92 | |
| sousaedu | 62191f4 | 2021-10-14 13:37:51 +0100 | [diff] [blame] | 93 | COPY scripts/ /app/osm_mon/scripts/ |
| 94 | |
| 95 | # Creating the user for the app |
| 96 | RUN groupadd -g 1000 appuser && \ |
| 97 | useradd -u 1000 -g 1000 -d /app appuser && \ |
| 98 | mkdir -p /app/osm_mon && \ |
| 99 | mkdir -p /app/storage/kafka && \ |
| 100 | mkdir /app/log && \ |
| 101 | chown -R appuser:appuser /app |
| 102 | |
| 103 | WORKDIR /app/osm_mon |
| 104 | |
| 105 | # Changing the security context |
| 106 | USER appuser |
| 107 | |
| 108 | ######################################################################## |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 109 | |
| Benjamin Diaz | e6f7b45 | 2019-02-07 12:09:57 -0300 | [diff] [blame] | 110 | ENV OSMMON_MESSAGE_DRIVER kafka |
| 111 | ENV OSMMON_MESSAGE_HOST kafka |
| 112 | ENV OSMMON_MESSAGE_PORT 9092 |
| 113 | |
| 114 | ENV OSMMON_DATABASE_DRIVER mongo |
| 115 | ENV OSMMON_DATABASE_URI mongodb://mongo:27017 |
| 116 | |
| 117 | ENV OSMMON_SQL_DATABASE_URI sqlite:///mon_sqlite.db |
| 118 | ENV OSMMON_OPENSTACK_DEFAULT_GRANULARITY 300 |
| 119 | ENV OSMMON_GLOBAL_REQUEST_TIMEOUT 10 |
| 120 | ENV OSMMON_GLOBAL_LOGLEVEL INFO |
| Benjamin Diaz | 6a23987 | 2018-11-15 10:31:08 -0300 | [diff] [blame] | 121 | ENV OSMMON_VCA_HOST localhost |
| 122 | ENV OSMMON_VCA_SECRET secret |
| 123 | ENV OSMMON_VCA_USER admin |
| lavado | d468d6c | 2019-12-06 06:54:18 -0500 | [diff] [blame] | 124 | ENV OSMMON_VCA_CACERT cacert |
| Benjamin Diaz | e6f7b45 | 2019-02-07 12:09:57 -0300 | [diff] [blame] | 125 | ENV OSMMON_DATABASE_COMMONKEY changeme |
| 126 | ENV OSMMON_COLLECTOR_INTERVAL 30 |
| 127 | ENV OSMMON_EVALUATOR_INTERVAL 30 |
| 128 | ENV OSMMON_PROMETHEUS_URL http://prometheus:9090 |
| bravof | cfbccb5 | 2020-04-01 11:01:11 -0300 | [diff] [blame] | 129 | ENV OSMMON_GRAFANA_URL http://grafana:3000 |
| 130 | ENV OSMMON_GRAFANA_USER admin |
| 131 | ENV OSMMON_GRAFANA_PASSWORD admin |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 132 | |
| Benjamin Diaz | 03ceed3 | 2018-11-21 18:10:05 -0300 | [diff] [blame] | 133 | EXPOSE 8000 |
| 134 | |
| palsus | e3cecd9 | 2021-01-18 08:36:26 +0000 | [diff] [blame] | 135 | HEALTHCHECK --start-period=120s --interval=5s --timeout=2s --retries=12\ |
| Benjamin Diaz | 03ceed3 | 2018-11-21 18:10:05 -0300 | [diff] [blame] | 136 | CMD osm-mon-healthcheck || exit 1 |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 137 | |
| garciadeblas | 626c9ee | 2025-04-24 13:03:27 +0200 | [diff] [blame] | 138 | CMD /bin/bash scripts/dashboarder-start.sh |