collection.dockerfile/debian/librenms/Dockerfile
2023-08-17 07:13:58 +08:00

21 lines
1.5 KiB
Docker

FROM debian
RUN apt update
RUN apt install -y apt-transport-https lsb-release ca-certificates wget bash acl curl fping git graphviz imagemagick mariadb-client mtr-tiny nginx-full nmap php-cli php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip python3-dotenv python3-pymysql python3-redis python3-setuptools python3-systemd python3-pip rrdtool snmp snmpd whois supervisor cron nginx-confgen
RUN useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
RUN git clone https://github.com/librenms/librenms.git /opt/librenms
RUN chown -R librenms:librenms /opt/librenms; chmod 771 /opt/librenms
RUN sed -i -e 's#;date.timezone.*#date.timezone=Asia/Hong_Kong#' /etc/php/8.2/fpm/php.ini
RUN ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
RUN sed -i 's/www-data/librenms/g' /etc/php/8.2/fpm/pool.d/www.conf
RUN sed -i 's/;listen.mode.*/listen.mode = 0666/g' /etc/php/8.2/fpm/pool.d/www.conf
RUN echo 'php_admin_value[date.timezone] = "Asia/Hong_Kong"' >> /etc/php/8.2/fpm/pool.d/www.conf
RUN su - librenms -c "/opt/librenms/scripts/composer_wrapper.php install --no-dev"
COPY nms-vhost.conf /etc/nginx/sites-enabled/nms-vhost.conf
COPY nms-spv.conf /etc/supervisor/conf.d/nms-spv.conf
RUN cp /opt/librenms/config.php.default /opt/librenms/config.php; chown librenms:librenms /opt/librenms/config.php
RUN pip3 install -r /opt/librenms/requirements.txt --break-system-packages
RUN cp crontab /var/spool/cron/crontabs/librenms; chmod 600 /var/spool/cron/crontabs/librenms
#ENTRYPOINT ["/bin/bash"]
EXPOSE 80
CMD ["/usr/bin/supervisord", "-n"]