blob: 86a0acf2104a8b709431354a0c2e9fbf1d1f3b27 [file] [log] [blame]
beierlme7646252022-01-13 10:53:08 -05001#######################################################################################
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 Marchetti182bd732018-09-05 09:52:42 -040010# 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#######################################################################################
Mike Marchetti182bd732018-09-05 09:52:42 -040017
Mark Beierl02feb8e2023-05-10 11:44:11 -040018FROM ubuntu:22.04 as INSTALL
Mike Marchetti182bd732018-09-05 09:52:42 -040019
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
garciadeblas10285302022-02-10 00:49:51 +010038RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
39 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblas2fc3deb2025-11-25 17:26:14 +010040 openssh-client=1:8.* git
Mike Marchetti182bd732018-09-05 09:52:42 -040041
garciadeblas2fc3deb2025-11-25 17:26:14 +010042ARG COMMON_GERRIT_REFSPEC=master
garciadeblas87a45b72025-12-09 20:01:03 +010043RUN pip3 install -U pip build
garciadeblas2fc3deb2025-11-25 17:26:14 +010044RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/common.git /tmp/osm-common && \
45 cd /tmp/osm-common && \
46 git fetch origin ${COMMON_GERRIT_REFSPEC} && \
47 git checkout FETCH_HEAD && \
48 cd - && \
garciadeblas87a45b72025-12-09 20:01:03 +010049 pip3 install --no-cache-dir -r /tmp/osm-common/requirements.txt && \
50 pip3 install /tmp/osm-common
garciadeblas2fc3deb2025-11-25 17:26:14 +010051
David Garciaa60ec732021-03-17 15:28:47 +010052ARG PYTHON3_OSM_MON_URL
David Garciaa60ec732021-03-17 15:28:47 +010053RUN curl $PYTHON3_OSM_MON_URL -o osm_mon.deb
54RUN dpkg -i ./osm_mon.deb
Mike Marchetti182bd732018-09-05 09:52:42 -040055
David Garciaa60ec732021-03-17 15:28:47 +010056RUN pip3 install \
David Garciaa60ec732021-03-17 15:28:47 +010057 -r /usr/lib/python3/dist-packages/osm_mon/requirements.txt
Felipe Vicensce8b5a42019-11-30 19:35:52 +010058
beierlmd7449362022-01-13 10:53:08 -050059#######################################################################################
Mark Beierl02feb8e2023-05-10 11:44:11 -040060#######################################################################################
61FROM ubuntu:22.04 as FINAL
Felipe Vicensce8b5a42019-11-30 19:35:52 +010062
beierlmd7449362022-01-13 10:53:08 -050063ARG APT_PROXY
64RUN if [ ! -z $APT_PROXY ] ; then \
65 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
66 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
67 fi
68
David Garciaa60ec732021-03-17 15:28:47 +010069RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020070 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Mark Beierl02feb8e2023-05-10 11:44:11 -040071 python3-minimal=3.10.* \
beierlmd7449362022-01-13 10:53:08 -050072 && rm -rf /var/lib/apt/lists/*
73
Mark Beierl02feb8e2023-05-10 11:44:11 -040074COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
75COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
76
77#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +020078# End of common preparation
Mark Beierl02feb8e2023-05-10 11:44:11 -040079
beierlmd7449362022-01-13 10:53:08 -050080RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
81 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblas6ba74b52021-09-23 17:43:15 +020082 ca-certificates \
83 && rm -rf /var/lib/apt/lists/*
beierlm023e83c2021-04-14 10:12:58 -040084
Mark Beierle5b9ba62022-09-08 05:44:06 -040085RUN rm -f /etc/apt/apt.conf.d/proxy.conf
86
David Garciaa60ec732021-03-17 15:28:47 +010087COPY --from=INSTALL /usr/bin/osm* /usr/bin/
beierlm023e83c2021-04-14 10:12:58 -040088COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
89COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
90COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
91COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
92COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
Felipe Vicensce8b5a42019-11-30 19:35:52 +010093
sousaedu62191f42021-10-14 13:37:51 +010094COPY scripts/ /app/osm_mon/scripts/
95
96# Creating the user for the app
97RUN groupadd -g 1000 appuser && \
98 useradd -u 1000 -g 1000 -d /app appuser && \
99 mkdir -p /app/osm_mon && \
100 mkdir -p /app/storage/kafka && \
101 mkdir /app/log && \
102 chown -R appuser:appuser /app
103
104WORKDIR /app/osm_mon
105
106# Changing the security context
107USER appuser
108
109########################################################################
Mike Marchetti182bd732018-09-05 09:52:42 -0400110
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300111ENV OSMMON_MESSAGE_DRIVER kafka
112ENV OSMMON_MESSAGE_HOST kafka
113ENV OSMMON_MESSAGE_PORT 9092
114
115ENV OSMMON_DATABASE_DRIVER mongo
116ENV OSMMON_DATABASE_URI mongodb://mongo:27017
117
118ENV OSMMON_SQL_DATABASE_URI sqlite:///mon_sqlite.db
119ENV OSMMON_OPENSTACK_DEFAULT_GRANULARITY 300
120ENV OSMMON_GLOBAL_REQUEST_TIMEOUT 10
121ENV OSMMON_GLOBAL_LOGLEVEL INFO
Benjamin Diaz6a239872018-11-15 10:31:08 -0300122ENV OSMMON_VCA_HOST localhost
123ENV OSMMON_VCA_SECRET secret
124ENV OSMMON_VCA_USER admin
lavadod468d6c2019-12-06 06:54:18 -0500125ENV OSMMON_VCA_CACERT cacert
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300126ENV OSMMON_DATABASE_COMMONKEY changeme
127ENV OSMMON_COLLECTOR_INTERVAL 30
128ENV OSMMON_EVALUATOR_INTERVAL 30
129ENV OSMMON_PROMETHEUS_URL http://prometheus:9090
bravofcfbccb52020-04-01 11:01:11 -0300130ENV OSMMON_GRAFANA_URL http://grafana:3000
131ENV OSMMON_GRAFANA_USER admin
132ENV OSMMON_GRAFANA_PASSWORD admin
Mike Marchetti182bd732018-09-05 09:52:42 -0400133
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300134EXPOSE 8000
135
palsuse3cecd92021-01-18 08:36:26 +0000136HEALTHCHECK --start-period=120s --interval=5s --timeout=2s --retries=12\
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300137 CMD osm-mon-healthcheck || exit 1
Mike Marchetti182bd732018-09-05 09:52:42 -0400138
garciadeblas626c9ee2025-04-24 13:03:27 +0200139CMD /bin/bash scripts/dashboarder-start.sh