docker-nagios-4/Dockerfile

49 lines
1.7 KiB
Docker

FROM ubuntu:focal
# Supervisor
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor && \
rm -rf /var/lib/apt/lists/*
# Apache
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 libapache2-mod-php7.4 apache2-utils && \
rm -rf /var/lib/apt/lists/*
ADD conf/apache2-site.conf /etc/apache2/sites-available/nagios.conf
RUN a2dissite 000-default && \
a2ensite nagios && \
a2enmod cgi
# Nagios
RUN apt-get update && \
groupadd -g 3000 nagios && \
useradd -u 3000 -g nagios -G www-data -m -s /bin/bash nagios && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wget gnupg iputils-ping && \
wget -qO- "http://artifact.scc.net.davepedu.com/repo/apt/nagios/dists/focal/install" | bash -x /dev/stdin && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y nagios=1:4.5.0-6dpedu1 nagios-nrpe-plugin=1:4.1.0-6dpedu1 nagios-nrpe-server=1:4.1.0-6dpedu1 nagios-plugins=1:4.0.1-6dpedu1 && \
printf "nagiosadmin:$(openssl passwd -crypt nagiosadmin)\n" >> /etc/nagios/htpasswd.users && \
update-alternatives --install /usr/bin/python python $(which python3) 2 && \
rm -rf /var/lib/apt/lists/*
# for testing a .deb file w/o repo, these lines can be substituted in above
# ADD nagios_4.5.0-6dpedu1_amd64.deb /tmp/nagios_4.5.0-6dpedu1_amd64.deb
# RUN ...
# DEBIAN_FRONTEND=noninteractive apt-get install -y wget gnupg iputils-ping libgd3 && \
# DEBIAN_FRONTEND=noninteractive dpkg -i /tmp/nagios_4.5.0-6dpedu1_amd64.deb && \
# ...
ADD conf/supervisor-all.conf /etc/supervisor/conf.d/
ADD sendmail.py /usr/local/bin/sendmail.py
ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]