blob: ba283c3aa86070320883fd3657597b4d6ac4dd8e [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
43RUN 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 Garciaa60ec732021-03-17 15:28:47 +010051ARG PYTHON3_OSM_MON_URL
David Garciaa60ec732021-03-17 15:28:47 +010052RUN curl $PYTHON3_OSM_MON_URL -o osm_mon.deb
53RUN dpkg -i ./osm_mon.deb
Mike Marchetti182bd732018-09-05 09:52:42 -040054
David Garciaa60ec732021-03-17 15:28:47 +010055RUN pip3 install \
David Garciaa60ec732021-03-17 15:28:47 +010056 -r /usr/lib/python3/dist-packages/osm_mon/requirements.txt
Felipe Vicensce8b5a42019-11-30 19:35:52 +010057
beierlmd7449362022-01-13 10:53:08 -050058#######################################################################################
Mark Beierl02feb8e2023-05-10 11:44:11 -040059#######################################################################################
60FROM ubuntu:22.04 as FINAL
Felipe Vicensce8b5a42019-11-30 19:35:52 +010061
beierlmd7449362022-01-13 10:53:08 -050062ARG APT_PROXY
63RUN 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 Garciaa60ec732021-03-17 15:28:47 +010068RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020069 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Mark Beierl02feb8e2023-05-10 11:44:11 -040070 python3-minimal=3.10.* \
beierlmd7449362022-01-13 10:53:08 -050071 && rm -rf /var/lib/apt/lists/*
72
Mark Beierl02feb8e2023-05-10 11:44:11 -040073COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
74COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
75
76#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +020077# End of common preparation
Mark Beierl02feb8e2023-05-10 11:44:11 -040078
beierlmd7449362022-01-13 10:53:08 -050079RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
80 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblas6ba74b52021-09-23 17:43:15 +020081 ca-certificates \
82 && rm -rf /var/lib/apt/lists/*
beierlm023e83c2021-04-14 10:12:58 -040083
Mark Beierle5b9ba62022-09-08 05:44:06 -040084RUN rm -f /etc/apt/apt.conf.d/proxy.conf
85
David Garciaa60ec732021-03-17 15:28:47 +010086COPY --from=INSTALL /usr/bin/osm* /usr/bin/
beierlm023e83c2021-04-14 10:12:58 -040087COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
88COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
89COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
90COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
91COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
Felipe Vicensce8b5a42019-11-30 19:35:52 +010092
sousaedu62191f42021-10-14 13:37:51 +010093COPY scripts/ /app/osm_mon/scripts/
94
95# Creating the user for the app
96RUN 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
103WORKDIR /app/osm_mon
104
105# Changing the security context
106USER appuser
107
108########################################################################
Mike Marchetti182bd732018-09-05 09:52:42 -0400109
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300110ENV OSMMON_MESSAGE_DRIVER kafka
111ENV OSMMON_MESSAGE_HOST kafka
112ENV OSMMON_MESSAGE_PORT 9092
113
114ENV OSMMON_DATABASE_DRIVER mongo
115ENV OSMMON_DATABASE_URI mongodb://mongo:27017
116
117ENV OSMMON_SQL_DATABASE_URI sqlite:///mon_sqlite.db
118ENV OSMMON_OPENSTACK_DEFAULT_GRANULARITY 300
119ENV OSMMON_GLOBAL_REQUEST_TIMEOUT 10
120ENV OSMMON_GLOBAL_LOGLEVEL INFO
Benjamin Diaz6a239872018-11-15 10:31:08 -0300121ENV OSMMON_VCA_HOST localhost
122ENV OSMMON_VCA_SECRET secret
123ENV OSMMON_VCA_USER admin
lavadod468d6c2019-12-06 06:54:18 -0500124ENV OSMMON_VCA_CACERT cacert
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300125ENV OSMMON_DATABASE_COMMONKEY changeme
126ENV OSMMON_COLLECTOR_INTERVAL 30
127ENV OSMMON_EVALUATOR_INTERVAL 30
128ENV OSMMON_PROMETHEUS_URL http://prometheus:9090
bravofcfbccb52020-04-01 11:01:11 -0300129ENV OSMMON_GRAFANA_URL http://grafana:3000
130ENV OSMMON_GRAFANA_USER admin
131ENV OSMMON_GRAFANA_PASSWORD admin
Mike Marchetti182bd732018-09-05 09:52:42 -0400132
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300133EXPOSE 8000
134
palsuse3cecd92021-01-18 08:36:26 +0000135HEALTHCHECK --start-period=120s --interval=5s --timeout=2s --retries=12\
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300136 CMD osm-mon-healthcheck || exit 1
Mike Marchetti182bd732018-09-05 09:52:42 -0400137
garciadeblas626c9ee2025-04-24 13:03:27 +0200138CMD /bin/bash scripts/dashboarder-start.sh