zabbix-docker/java-gateway/centos/Dockerfile

88 lines
3.2 KiB
Docker
Raw Normal View History

2020-04-26 18:45:42 +02:00
FROM centos:centos7
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/ && \
yum --quiet makecache && \
yum -y install --setopt=tsflags=nodocs \
java-1.8.0-openjdk-headless && \
yum -y clean all && \
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
rm -rf /etc/udev/hwdb.bin /root/.pki
2018-05-26 12:58:52 +02:00
ARG MAJOR_VERSION=master
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
2019-05-30 20:21:16 +02:00
RUN set -eux && \
2020-04-26 18:45:42 +02:00
yum --quiet makecache && \
2020-04-27 16:05:27 +02:00
yum -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-10 16:11:07 +02:00
git clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --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}/ && \
yum -y history undo `yum -q history | sed -n 3p |column -t | cut -d' ' -f1` && \
yum -y clean all && \
chown --quiet -R zabbix:root /etc/zabbix/ && \
chgrp -R 0 /etc/zabbix/ && \
chmod -R g=u /etc/zabbix/ && \
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
rm -rf /etc/udev/hwdb.bin /root/.pki
2018-02-18 21:45:33 +01:00
EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix
COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"]
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"]