zabbix-docker/java-gateway/centos/Dockerfile

91 lines
3.3 KiB
Docker
Raw Normal View History

FROM centos:centos8
2020-04-26 18:45:42 +02:00
LABEL org.opencontainers.image.title="Zabbix Java Gateway" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
org.opencontainers.image.licenses="GPL v2.0"
STOPSIGNAL SIGTERM
RUN set -eux && \
groupadd -g 1995 --system zabbix && \
adduser -r --shell /sbin/nologin \
-g zabbix -G root \
-d /var/lib/zabbix/ -u 1997 \
zabbix && \
mkdir -p /etc/zabbix/ && \
mkdir -p /usr/sbin/zabbix_java/ && \
dnf --quiet makecache && \
dnf -y install --setopt=tsflags=nodocs \
2020-04-26 18:45:42 +02:00
java-1.8.0-openjdk-headless && \
dnf -y clean all && \
2020-04-26 18:45:42 +02:00
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
2018-05-26 12:58:52 +02:00
2019-11-14 06:28:37 +01:00
ARG MAJOR_VERSION=5.0
2018-05-26 12:58:52 +02:00
ARG ZBX_VERSION=${MAJOR_VERSION}
2019-05-10 16:11:07 +02:00
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
2020-04-26 18:45:42 +02:00
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.version="${ZBX_VERSION}" \
org.opencontainers.image.source="${ZBX_SOURCES}"
2018-05-26 12:58:52 +02:00
2020-04-27 17:27:35 +02:00
COPY ["conf/etc/", "/etc/"]
2019-05-30 20:21:16 +02:00
RUN set -eux && \
dnf --quiet makecache && \
dnf -y install --setopt=tsflags=nodocs \
2018-05-26 12:58:52 +02:00
autoconf \
automake \
java-1.8.0-openjdk-devel \
make \
2019-05-10 16:11:07 +02:00
git \
2018-05-26 12:58:52 +02:00
gcc && \
cd /tmp/ && \
2019-05-14 10:06:13 +02:00
git clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \
2018-05-26 12:58:52 +02:00
cd /tmp/zabbix-${ZBX_VERSION} && \
2019-05-10 16:11:07 +02:00
zabbix_revision=`git rev-parse --short HEAD` && \
2018-05-26 12:58:52 +02:00
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 && \
2018-05-26 12:58:52 +02:00
./configure \
--datadir=/usr/lib \
--libdir=/usr/lib/zabbix \
--sysconfdir=/etc/zabbix \
--prefix=/usr \
--enable-java \
--silent && \
make -j"$(nproc)" -s && \
2018-05-26 12:58:52 +02:00
mkdir -p /usr/sbin/zabbix_java/ && \
2020-04-26 18:45:42 +02:00
cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \
rm -rf /usr/sbin/zabbix_java/lib/*.xml && \
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
dnf -y history undo `dnf -q history | sed -n 3p |column -t | cut -d' ' -f1` && \
dnf -y clean all && \
2020-04-27 17:27:35 +02:00
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/ && \
2020-04-26 18:45:42 +02:00
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
2018-02-18 21:45:33 +01:00
EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix
VOLUME ["/usr/sbin/zabbix_java/ext_lib"]
2018-02-18 21:45:33 +01:00
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["docker-entrypoint.sh"]
2020-04-26 18:45:42 +02:00
USER 1997
CMD ["/usr/sbin/zabbix_java_gateway"]