zabbix-docker/Dockerfiles/java-gateway/rhel/Dockerfile

115 lines
5.0 KiB
Docker
Raw Normal View History

2021-06-11 23:07:45 +02:00
FROM registry.access.redhat.com/ubi8/ubi
MAINTAINER Alexey Pustovalov <alexey.pustovalov@zabbix.com>
ARG MAJOR_VERSION=6.0
ARG RELEASE=
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL name="zabbix/zabbix-java-gateway-trunk" \
maintainer="alexey.pustovalov@zabbix.com" \
vendor="Zabbix LLC" \
version="${MAJOR_VERSION}" \
release="${RELEASE}" \
summary="Zabbix Java Gateway" \
description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
url="https://www.zabbix.com/" \
run="docker run --name zabbix-java-gateway -p 10052:10052 -d registry.connect.redhat.com/zabbix/zabbix-java-gateway-trunk:${ZBX_VERSION}" \
io.k8s.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
io.k8s.display-name="Zabbix Java Gateway" \
io.openshift.expose-services="10052:10052" \
io.openshift.tags="gateway,zabbix-java,java" \
org.label-schema.name="zabbix-java-gateway-rhel" \
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \
org.label-schema.license="GPL v2.0" \
org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-java-gateway -p 10052:10052 -d registry.connect.redhat.com/zabbix/zabbix-java-gateway-trunk:${ZBX_VERSION}"
STOPSIGNAL SIGTERM
COPY ["licenses", "/licenses"]
RUN set -eux && INSTALL_PKGS="bash \
java-1.8.0-openjdk-headless" && \
2021-09-03 21:53:20 +02:00
REPOLIST="ubi-8-baseos,ubi-8-appstream" && \
dnf -y update-minimal --disablerepo "*" --enablerepo "ubi-8-baseos" --setopt=tsflags=nodocs \
--security --sec-severity=Important --setopt=install_weak_deps=False --sec-severity=Critical && \
2021-06-11 23:07:45 +02:00
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
--setopt=tsflags=nodocs ${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 /etc/zabbix/ && \
mkdir -p /usr/sbin/zabbix_java/ && \
mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \
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
RUN set -eux && INSTALL_PKGS="autoconf \
automake \
pkgconf \
git \
gcc \
make \
java-1.8.0-openjdk-devel" && \
2021-09-03 21:53:20 +02:00
REPOLIST="ubi-8-baseos,ubi-8-appstream" && \
2021-06-11 23:07:45 +02:00
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
--setopt=tsflags=nodocs ${INSTALL_PKGS} && \
cd /tmp/ && \
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \
cd /tmp/zabbix-${ZBX_VERSION} && \
zabbix_revision=`git rev-parse --short HEAD` && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \
./bootstrap.sh && \
./configure \
--datadir=/usr/lib \
--libdir=/usr/lib/zabbix \
--sysconfdir=/etc/zabbix \
--prefix=/usr \
--enable-java \
--silent && \
make -j"$(nproc)" -s && \
mkdir -p /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \
2021-09-13 17:56:09 +02:00
rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \
mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \
2021-06-11 23:07:45 +02:00
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
dnf -y history undo last && \
dnf -y clean all && \
chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \
chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \
chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \
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 10052/TCP
WORKDIR /var/lib/zabbix
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"]
USER 1997
CMD ["/usr/sbin/zabbix_java_gateway"]