blob: d37ce7421fb6b33de007aa43bc34574875774a5e [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 \
beierlmd7449362022-01-13 10:53:08 -050040 openssh-client=1:8.*
Mike Marchetti182bd732018-09-05 09:52:42 -040041
David Garciaa60ec732021-03-17 15:28:47 +010042ARG PYTHON3_OSM_COMMON_URL
43ARG PYTHON3_OSM_MON_URL
44ARG PYTHON3_N2VC_URL
Mike Marchetti13d76c82018-09-19 15:00:36 -040045
David Garciaa60ec732021-03-17 15:28:47 +010046RUN curl $PYTHON3_OSM_COMMON_URL -o osm_common.deb
47RUN dpkg -i ./osm_common.deb
Benjamin Diaz14017e52018-11-20 12:35:06 -030048
David Garciaa60ec732021-03-17 15:28:47 +010049RUN curl $PYTHON3_N2VC_URL -o n2vc.deb
50RUN dpkg -i ./n2vc.deb
Mike Marchetti182bd732018-09-05 09:52:42 -040051
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 \
56 -r /usr/lib/python3/dist-packages/n2vc/requirements.txt \
57 -r /usr/lib/python3/dist-packages/osm_common/requirements.txt \
58 -r /usr/lib/python3/dist-packages/osm_mon/requirements.txt
Felipe Vicensce8b5a42019-11-30 19:35:52 +010059
beierlmd7449362022-01-13 10:53:08 -050060#######################################################################################
Mark Beierl02feb8e2023-05-10 11:44:11 -040061#######################################################################################
62FROM ubuntu:22.04 as FINAL
Felipe Vicensce8b5a42019-11-30 19:35:52 +010063
beierlmd7449362022-01-13 10:53:08 -050064ARG APT_PROXY
65RUN if [ ! -z $APT_PROXY ] ; then \
66 echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
67 echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
68 fi
69
David Garciaa60ec732021-03-17 15:28:47 +010070RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
garciadeblas15897d62021-09-22 18:11:54 +020071 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
Mark Beierl02feb8e2023-05-10 11:44:11 -040072 python3-minimal=3.10.* \
beierlmd7449362022-01-13 10:53:08 -050073 && rm -rf /var/lib/apt/lists/*
74
Mark Beierl02feb8e2023-05-10 11:44:11 -040075COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
76COPY --from=INSTALL /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
77
78#######################################################################################
garciadeblas21503ab2023-06-28 14:31:27 +020079# End of common preparation
Mark Beierl02feb8e2023-05-10 11:44:11 -040080
beierlmd7449362022-01-13 10:53:08 -050081RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
82 DEBIAN_FRONTEND=noninteractive apt-get --yes install \
garciadeblas6ba74b52021-09-23 17:43:15 +020083 ca-certificates \
84 && rm -rf /var/lib/apt/lists/*
beierlm023e83c2021-04-14 10:12:58 -040085
Mark Beierle5b9ba62022-09-08 05:44:06 -040086RUN rm -f /etc/apt/apt.conf.d/proxy.conf
87
David Garciaa60ec732021-03-17 15:28:47 +010088COPY --from=INSTALL /usr/bin/osm* /usr/bin/
beierlm023e83c2021-04-14 10:12:58 -040089COPY --from=INSTALL /usr/bin/scp /usr/bin/scp
90COPY --from=INSTALL /usr/bin/ssh-keygen /usr/bin/ssh-keygen
91COPY --from=INSTALL /usr/bin/ssh /usr/bin/ssh
92COPY --from=INSTALL /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
93COPY --from=INSTALL /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
Felipe Vicensce8b5a42019-11-30 19:35:52 +010094
sousaedu62191f42021-10-14 13:37:51 +010095COPY scripts/ /app/osm_mon/scripts/
96
97# Creating the user for the app
98RUN groupadd -g 1000 appuser && \
99 useradd -u 1000 -g 1000 -d /app appuser && \
100 mkdir -p /app/osm_mon && \
101 mkdir -p /app/storage/kafka && \
102 mkdir /app/log && \
103 chown -R appuser:appuser /app
104
105WORKDIR /app/osm_mon
106
107# Changing the security context
108USER appuser
109
110########################################################################
Mike Marchetti182bd732018-09-05 09:52:42 -0400111
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300112ENV OSMMON_MESSAGE_DRIVER kafka
113ENV OSMMON_MESSAGE_HOST kafka
114ENV OSMMON_MESSAGE_PORT 9092
115
116ENV OSMMON_DATABASE_DRIVER mongo
117ENV OSMMON_DATABASE_URI mongodb://mongo:27017
118
119ENV OSMMON_SQL_DATABASE_URI sqlite:///mon_sqlite.db
120ENV OSMMON_OPENSTACK_DEFAULT_GRANULARITY 300
121ENV OSMMON_GLOBAL_REQUEST_TIMEOUT 10
122ENV OSMMON_GLOBAL_LOGLEVEL INFO
Benjamin Diaz6a239872018-11-15 10:31:08 -0300123ENV OSMMON_VCA_HOST localhost
124ENV OSMMON_VCA_SECRET secret
125ENV OSMMON_VCA_USER admin
lavadod468d6c2019-12-06 06:54:18 -0500126ENV OSMMON_VCA_CACERT cacert
Benjamin Diaze6f7b452019-02-07 12:09:57 -0300127ENV OSMMON_DATABASE_COMMONKEY changeme
128ENV OSMMON_COLLECTOR_INTERVAL 30
129ENV OSMMON_EVALUATOR_INTERVAL 30
130ENV OSMMON_PROMETHEUS_URL http://prometheus:9090
bravofcfbccb52020-04-01 11:01:11 -0300131ENV OSMMON_GRAFANA_URL http://grafana:3000
132ENV OSMMON_GRAFANA_USER admin
133ENV OSMMON_GRAFANA_PASSWORD admin
Mike Marchetti182bd732018-09-05 09:52:42 -0400134
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300135EXPOSE 8000
136
palsuse3cecd92021-01-18 08:36:26 +0000137HEALTHCHECK --start-period=120s --interval=5s --timeout=2s --retries=12\
Benjamin Diaz03ceed32018-11-21 18:10:05 -0300138 CMD osm-mon-healthcheck || exit 1
Mike Marchetti182bd732018-09-05 09:52:42 -0400139
garciadeblas626c9ee2025-04-24 13:03:27 +0200140CMD /bin/bash scripts/dashboarder-start.sh