zabbix-docker/java-gateway/centos/Dockerfile

97 lines
3.5 KiB
Docker
Raw Normal View History

2018-05-26 12:58:52 +02:00
FROM centos:centos7 as builder
ARG YUM_FLAGS_COMMON="-y"
2018-05-26 12:58:52 +02:00
ARG YUM_FLAGS_DEV="${YUM_FLAGS_COMMON}"
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
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
ZBX_TYPE=java-gateway
2018-05-26 12:58:52 +02:00
2019-05-30 20:21:16 +02:00
RUN set -eux && \
yum ${YUM_FLAGS_COMMON} makecache && \
2018-05-26 12:58:52 +02:00
yum ${YUM_FLAGS_DEV} install \
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
rm -rf src/zabbix_java/lib/*.xml
2018-02-18 21:45:33 +01:00
FROM centos:centos7
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE
ARG VCS_REF
ARG YUM_FLAGS_COMMON="-y"
ARG YUM_FLAGS_PERSISTENT="${YUM_FLAGS_COMMON}"
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
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
ZBX_TYPE=java-gateway ZBX_DB_TYPE=none ZBX_OPT_TYPE=none
2018-02-18 21:45:33 +01:00
LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-centos" \
2018-02-18 21:45:33 +01:00
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" \
2018-05-26 12:58:52 +02:00
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-${ZBX_TYPE} --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-${ZBX_TYPE}:centos-${ZBX_VERSION}"
2018-02-18 21:45:33 +01:00
STOPSIGNAL SIGTERM
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin/* /usr/sbin/zabbix_java/bin/
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib/* /usr/sbin/zabbix_java/lib/
2019-05-30 20:21:16 +02:00
RUN set -eux && \
groupadd --system zabbix && \
2018-02-18 21:45:33 +01:00
adduser --system --shell /sbin/nologin \
-g zabbix \
-d /var/lib/zabbix/ \
zabbix && \
mkdir -p /etc/zabbix/ && \
chown --quiet -R zabbix:root /etc/zabbix && \
2018-05-26 12:58:52 +02:00
mkdir -p /usr/sbin/zabbix_java/ && \
2018-02-18 21:45:33 +01:00
yum ${YUM_FLAGS_COMMON} makecache && \
yum ${YUM_FLAGS_PERSISTENT} install \
java-1.8.0-openjdk-headless && \
yum ${YUM_FLAGS_PERSISTENT} clean all && \
2018-02-18 21:45:33 +01:00
rm -rf /var/cache/yum/
EXPOSE 10052/TCP
WORKDIR /var/lib/zabbix
VOLUME ["/usr/sbin/zabbix_java/ext_lib"]
2018-02-18 21:45:33 +01:00
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"]