1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 18:25:09 +00:00
librenms-docker/Dockerfile
2022-10-22 08:52:43 +02:00

147 lines
3.9 KiB
Docker

# syntax=docker/dockerfile:1
ARG LIBRENMS_VERSION="22.10.0"
ARG WEATHERMAP_PLUGIN_COMMIT="697ac3cdb517aedc81d3b0b2e9ae5582234dca54"
ARG ALPINE_VERSION="3.16"
FROM crazymax/yasu:latest AS yasu
FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3
COPY --from=yasu / /
RUN apk --update --no-cache add \
busybox-extras \
acl \
bash \
bind-tools \
binutils \
ca-certificates \
coreutils \
curl \
file \
fping \
git \
graphviz \
imagemagick \
ipmitool \
iputils \
mariadb-client \
monitoring-plugins \
mtr \
net-snmp \
net-snmp-tools \
nginx \
nmap \
openssl \
openssh-client \
perl \
php8 \
php8-cli \
php8-ctype \
php8-curl \
php8-dom \
php8-fileinfo \
php8-fpm \
php8-gd \
php8-gmp \
php8-json \
php8-ldap \
php8-mbstring \
php8-mysqlnd \
php8-opcache \
php8-openssl \
php8-pdo \
php8-pdo_mysql \
php8-pecl-mcrypt \
php8-pecl-memcached \
php8-pear \
php8-phar \
php8-posix \
php8-session \
php8-simplexml \
php8-snmp \
php8-sockets \
php8-tokenizer \
php8-xml \
php8-zip \
python3 \
py3-pip \
rrdtool \
runit \
shadow \
syslog-ng=3.36.1-r0 \
ttf-dejavu \
tzdata \
util-linux \
whois \
&& apk --update --no-cache add -t build-dependencies \
build-base \
make \
mariadb-dev \
musl-dev \
python3-dev \
&& pip3 install --upgrade pip \
&& pip3 install python-memcached mysqlclient --upgrade \
&& curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& apk del build-dependencies \
&& rm -rf /var/www/* /tmp/* \
&& echo "/usr/sbin/fping -6 \$@" > /usr/sbin/fping6 \
&& chmod +x /usr/sbin/fping6 \
&& chmod u+s,g+s \
/bin/ping \
/bin/ping6 \
/usr/lib/monitoring-plugins/check_icmp \
&& setcap cap_net_raw+ep /usr/bin/nmap \
&& setcap cap_net_raw+ep /usr/sbin/fping \
&& setcap cap_net_raw+ep /usr/sbin/fping6 \
&& setcap cap_net_raw+ep /usr/lib/monitoring-plugins/check_icmp \
&& setcap cap_net_raw+ep /usr/lib/monitoring-plugins/check_ping
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
LIBRENMS_PATH="/opt/librenms" \
LIBRENMS_DOCKER="1" \
TZ="UTC" \
PUID="1000" \
PGID="1000"
RUN addgroup -g ${PGID} librenms \
&& adduser -D -h /home/librenms -u ${PUID} -G librenms -s /bin/sh -D librenms \
&& curl -sSLk -q https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro -o /usr/bin/distro \
&& chmod +x /usr/bin/distro
WORKDIR ${LIBRENMS_PATH}
ARG LIBRENMS_VERSION
ARG WEATHERMAP_PLUGIN_COMMIT
RUN apk --update --no-cache add -t build-dependencies \
build-base \
linux-headers \
musl-dev \
python3-dev \
&& git clone --depth=1 --branch ${LIBRENMS_VERSION} https://github.com/librenms/librenms.git . \
&& pip3 install --ignore-installed -r requirements.txt --upgrade \
&& COMPOSER_CACHE_DIR="/tmp" composer install --no-dev --no-interaction --no-ansi \
&& mkdir config.d \
&& cp config.php.default config.php \
&& cp snmpd.conf.example /etc/snmp/snmpd.conf \
&& sed -i '/runningUser/d' lnms \
&& echo "foreach (glob(\"/data/config/*.php\") as \$filename) include \$filename;" >> config.php \
&& echo "foreach (glob(\"${LIBRENMS_PATH}/config.d/*.php\") as \$filename) include \$filename;" >> config.php \
&& ( \
git clone --depth=1 https://github.com/librenms-plugins/Weathermap.git ./html/plugins/Weathermap \
&& cd ./html/plugins/Weathermap \
&& git reset --hard $WEATHERMAP_PLUGIN_COMMIT \
) \
&& chown -R nobody:nogroup ${LIBRENMS_PATH} \
&& apk del build-dependencies \
&& rm -rf .git \
html/plugins/Test \
html/plugins/Weathermap/.git \
html/plugins/Weathermap/configs \
doc/ \
tests/ \
/tmp/*
COPY rootfs /
EXPOSE 8000 514 514/udp 162 162/udp
VOLUME [ "/data" ]
ENTRYPOINT [ "/init" ]