wip
This commit is contained in:
@@ -1,26 +1,77 @@
|
|||||||
ARG BUILD_ARCH
|
ARG MAJOR_VERSION=7.0
|
||||||
ARG BUILD_VERSION
|
ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||||
ARG BUILD_BASE_IMAGE=zabbix/zabbix-agent2:alpine-trunk
|
ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION}
|
||||||
|
|
||||||
FROM ${BUILD_BASE_IMAGE} as builder
|
FROM ${BUILD_BASE_IMAGE} AS builder
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine:3.19
|
||||||
|
|
||||||
LABEL maintainer "Philipp Schmitt <philipp@schmitt.co>"
|
ARG MAJOR_VERSION
|
||||||
|
ARG ZBX_VERSION
|
||||||
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
||||||
|
|
||||||
ENV LANG C.UTF-8
|
ENV TERM=xterm \
|
||||||
|
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
|
||||||
|
|
||||||
# Install requirements for add-on
|
STOPSIGNAL SIGTERM
|
||||||
# RUN apk add --no-cache jq zabbix-agent2 && \
|
|
||||||
# addgroup -g 1003 docker && \
|
|
||||||
# addgroup zabbix docker && \
|
|
||||||
# mkdir -p /etc/zabbix/zabbix_agent2.d/plugins.d
|
|
||||||
|
|
||||||
# Copy zabbix-agent2 plugins
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"]
|
||||||
# COPY --from=builder ["/usr/sbin/zabbix-agent2-plugin", "/usr/sbin/zabbix-agent2-plugin"]
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"]
|
||||||
# RUN echo -e "\nPlugins.PostgreSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb\nPlugins.PostgreSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql\n" >> /etc/zabbix/zabbix_agent2.conf
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"]
|
||||||
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"]
|
||||||
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.d/plugins.d", "/etc/zabbix/zabbix_agent2.d/plugins.d"]
|
||||||
|
COPY --from=builder ["/tmp/mongodb_plugin/mongodb.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/mongodb.conf"]
|
||||||
|
COPY --from=builder ["/tmp/postgresql_plugin/postgresql.conf", "/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf"]
|
||||||
|
COPY --from=builder ["/tmp/mongodb_plugin/zabbix-agent2-plugin-mongodb", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mongodb"]
|
||||||
|
COPY --from=builder ["/tmp/postgresql_plugin/zabbix-agent2-plugin-postgresql", "/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql"]
|
||||||
|
|
||||||
# Copy data for add-on
|
RUN set -eux && \
|
||||||
|
INSTALL_PKGS="bash \
|
||||||
|
tzdata \
|
||||||
|
pcre2 \
|
||||||
|
coreutils \
|
||||||
|
smartmontools \
|
||||||
|
sudo \
|
||||||
|
iputils" && \
|
||||||
|
apk add \
|
||||||
|
--no-cache \
|
||||||
|
--clean-protected \
|
||||||
|
${INSTALL_PKGS} && \
|
||||||
|
addgroup \
|
||||||
|
--system \
|
||||||
|
--gid 1995 \
|
||||||
|
zabbix && \
|
||||||
|
adduser \
|
||||||
|
--system \
|
||||||
|
--gecos "Zabbix monitoring system" \
|
||||||
|
--disabled-password \
|
||||||
|
--uid 1997 \
|
||||||
|
--ingroup zabbix \
|
||||||
|
--shell /sbin/nologin \
|
||||||
|
--home /var/lib/zabbix/ \
|
||||||
|
zabbix && \
|
||||||
|
echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \
|
||||||
|
mkdir -p /etc/zabbix && \
|
||||||
|
mkdir -p /etc/zabbix/zabbix_agentd.d && \
|
||||||
|
mkdir -p /var/lib/zabbix && \
|
||||||
|
mkdir -p /var/lib/zabbix/enc && \
|
||||||
|
mkdir -p /var/lib/zabbix/modules && \
|
||||||
|
mkdir -p /var/lib/zabbix/buffer && \
|
||||||
|
chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \
|
||||||
|
chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/ && \
|
||||||
|
chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/sbin/zabbix-agent2-plugin/
|
||||||
|
|
||||||
|
EXPOSE 10050/TCP 31999/TCP
|
||||||
|
|
||||||
|
WORKDIR /var/lib/zabbix
|
||||||
|
|
||||||
|
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
USER 1997
|
||||||
|
|
||||||
|
# CMD ["/usr/sbin/zabbix_agent2", "--foreground", "-c", "/etc/zabbix/zabbix_agent2.conf"]
|
||||||
COPY run.sh /
|
COPY run.sh /
|
||||||
RUN chmod a+x /run.sh
|
RUN chmod a+x /run.sh
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user