zabbix-docker/java-gateway/ubuntu/Dockerfile
2017-04-28 16:27:56 +03:00

88 lines
3.2 KiB
Docker

FROM ubuntu:trusty
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG APT_FLAGS_COMMON="-qq -y"
ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends"
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm
RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \
locale-gen $LC_ALL && \
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \
addgroup --system --quiet zabbix && \
adduser --quiet \
--system --disabled-login \
--ingroup zabbix \
--home /var/lib/zabbix/ \
--no-create-home \
zabbix && \
mkdir -p /etc/zabbix/ && \
chown --quiet -R zabbix:root /etc/zabbix && \
apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_PERSISTANT} install \
supervisor \
openjdk-7-jre-headless 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \
rm -rf /var/lib/apt/lists/*
ARG MAJOR_VERSION=3.0
ARG ZBX_VERSION=${MAJOR_VERSION}.9
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
RUN apt-get ${APT_FLAGS_COMMON} update && \
apt-get ${APT_FLAGS_DEV} install \
gcc \
make \
automake \
libc6-dev \
pkg-config \
openjdk-7-jdk \
subversion 1>/dev/null && \
cd /tmp/ && \
svn --quiet export ${ZBX_SOURCES} zabbix-${ZBX_VERSION} 1>/dev/null && \
cd /tmp/zabbix-${ZBX_VERSION} && \
zabbix_revision=`svn info ${ZBX_SOURCES} |grep "Last Changed Rev"|awk '{print $4;}'` && \
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 1>/dev/null && \
./configure \
--prefix=/usr \
--silent \
--sysconfdir=/etc/zabbix \
--libdir=/usr/lib/zabbix \
--datadir=/usr/lib \
--enable-java && \
make -j"$(nproc)" -s 1>/dev/null && \
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/ && \
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apt-get ${APT_FLAGS_COMMON} purge \
gcc \
make \
automake \
libc6-dev \
pkg-config \
openjdk-7-jdk \
subversion 1>/dev/null && \
apt-get ${APT_FLAGS_COMMON} autoremove && \
apt-get ${APT_FLAGS_COMMON} clean && \
rm -rf /var/lib/apt/lists/*
EXPOSE 10052/TCP
WORKDIR /usr/sbin/zabbix_java/
ADD conf/etc/supervisor/ /etc/supervisor/
ADD conf/etc/zabbix/zabbix_java_gateway_logback.xml /etc/zabbix/
ADD conf/usr/sbin/zabbix_java_gateway /usr/sbin/
ADD run_zabbix_component.sh /
ENTRYPOINT ["/bin/bash"]
CMD ["/run_zabbix_component.sh", "java-gateway", "none"]