zabbix-docker/Dockerfiles/snmptraps/centos/Dockerfile
Continuous Integration 0fa8715697 Zabbix v6.4.2 release
2023-04-25 14:34:46 +03:00

72 lines
2.5 KiB
Docker

FROM quay.io/centos/centos:stream9
ARG MAJOR_VERSION=6.4
ARG ZBX_VERSION=${MAJOR_VERSION}.2
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV TERM=xterm \
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT="\n"
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.title="zabbix-snmptraps" \
org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.version="${ZBX_VERSION}"
STOPSIGNAL SIGTERM
RUN set -eux && \
REPOLIST="baseos,appstream" && \
INSTALL_PKGS="bash \
tzdata \
net-snmp" && \
dnf -y install \
--disablerepo "*" \
--enablerepo "${REPOLIST}" \
--setopt=tsflags=nodocs \
--setopt=install_weak_deps=False \
--best \
${INSTALL_PKGS} && \
groupadd \
--system \
--gid 1995 \
zabbix && \
useradd \
--system \
--comment "Zabbix monitoring system" \
-g zabbix \
-G root \
--uid 1997 \
--shell /sbin/nologin \
--home-dir /var/lib/zabbix/ \
zabbix && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \
touch /var/lib/net-snmp/snmptrapd.conf && \
chown --quiet -R zabbix:root /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
chgrp -R 0 /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
chmod -R g=u /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
dnf -y clean all && \
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki
EXPOSE 1162/UDP
WORKDIR /var/lib/zabbix/snmptraps/
VOLUME ["/var/lib/zabbix/snmptraps"]
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"]
USER 1997
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]