2018-07-19 12:37:11 +02:00
|
|
|
FROM ubuntu:bionic as builder
|
2018-05-29 14:23:20 +02:00
|
|
|
|
2018-05-31 09:50:32 +02:00
|
|
|
ARG APT_FLAGS_COMMON="-y"
|
2018-05-29 14:23:20 +02:00
|
|
|
ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends"
|
2018-05-31 09:50:32 +02:00
|
|
|
|
2018-05-30 07:44:48 +02:00
|
|
|
ARG MAJOR_VERSION=4.0
|
2019-04-18 17:51:07 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.7
|
2018-10-02 12:13:01 +02:00
|
|
|
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
|
2018-05-29 14:23:20 +02:00
|
|
|
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
|
|
|
LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
|
2018-09-28 13:17:05 +02:00
|
|
|
MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
|
2018-05-29 14:23:20 +02:00
|
|
|
ZBX_TYPE=server ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=nginx \
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD=true ZBX_ADD_SERVER=true ZBX_ADD_WEB=true DB_SERVER_HOST=localhost MYSQL_USER=zabbix ZBX_ADD_JAVA_GATEWAY=true ZBX_JAVAGATEWAY_ENABLE=true ZBX_JAVAGATEWAY=localhost
|
|
|
|
|
|
|
|
COPY ["conf/tmp/font-config", "/tmp/font-config"]
|
|
|
|
|
2018-07-20 05:52:59 +02:00
|
|
|
RUN apt-get ${APT_FLAGS_COMMON} update && \
|
|
|
|
apt-get ${APT_FLAGS_DEV} install locales && \
|
|
|
|
locale-gen $LC_ALL && \
|
2018-05-29 14:23:20 +02:00
|
|
|
apt-get ${APT_FLAGS_COMMON} update && \
|
|
|
|
apt-get ${APT_FLAGS_DEV} install \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
gcc \
|
|
|
|
gettext \
|
|
|
|
libc6-dev \
|
|
|
|
libcurl4-openssl-dev \
|
2018-05-30 07:44:48 +02:00
|
|
|
libevent-dev \
|
2018-05-29 14:23:20 +02:00
|
|
|
libiksemel-dev \
|
|
|
|
libldap2-dev \
|
|
|
|
libmysqlclient-dev \
|
|
|
|
libopenipmi-dev \
|
2018-05-30 07:44:48 +02:00
|
|
|
libpcre3-dev \
|
2018-05-29 14:23:20 +02:00
|
|
|
libsnmp-dev \
|
|
|
|
libssh2-1-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
make \
|
2018-07-20 05:52:59 +02:00
|
|
|
openjdk-8-jdk \
|
2018-05-29 14:23:20 +02:00
|
|
|
patch \
|
|
|
|
pkg-config \
|
|
|
|
subversion \
|
2018-05-31 09:50:32 +02:00
|
|
|
unixodbc-dev && \
|
2018-05-29 14:23:20 +02:00
|
|
|
cd /tmp/ && \
|
2018-05-31 09:50:32 +02:00
|
|
|
svn --quiet export ${ZBX_SOURCES} zabbix-${ZBX_VERSION} && \
|
2018-05-29 14:23:20 +02:00
|
|
|
cd /tmp/zabbix-${ZBX_VERSION} && \
|
2018-05-31 09:50:32 +02:00
|
|
|
zabbix_revision=`svn info ${ZBX_SOURCES} | grep "Last Changed Rev"|awk '{print $4;}'` && \
|
2018-05-29 14:23:20 +02:00
|
|
|
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \
|
|
|
|
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 && \
|
2018-05-31 09:50:32 +02:00
|
|
|
./bootstrap.sh && \
|
2018-05-29 14:23:20 +02:00
|
|
|
export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \
|
|
|
|
./configure \
|
|
|
|
--datadir=/usr/lib \
|
|
|
|
--libdir=/usr/lib/zabbix \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc/zabbix \
|
|
|
|
--enable-agent \
|
|
|
|
--enable-${ZBX_TYPE} \
|
|
|
|
--with-${ZBX_DB_TYPE} \
|
|
|
|
--with-jabber \
|
|
|
|
--with-ldap \
|
|
|
|
--with-libcurl \
|
|
|
|
--with-libxml2 \
|
|
|
|
--enable-java \
|
|
|
|
--with-net-snmp \
|
|
|
|
--with-openipmi \
|
|
|
|
--with-openssl \
|
|
|
|
--with-ssh2 \
|
|
|
|
--with-unixodbc \
|
|
|
|
--enable-ipv6 \
|
|
|
|
--silent && \
|
2018-05-31 09:50:32 +02:00
|
|
|
make -j"$(nproc)" -s dbschema && \
|
|
|
|
make -j"$(nproc)" -s && \
|
2018-05-29 14:23:20 +02:00
|
|
|
cat database/${ZBX_DB_TYPE}/schema.sql > database/${ZBX_DB_TYPE}/create.sql && \
|
|
|
|
cat database/${ZBX_DB_TYPE}/images.sql >> database/${ZBX_DB_TYPE}/create.sql && \
|
|
|
|
cat database/${ZBX_DB_TYPE}/data.sql >> database/${ZBX_DB_TYPE}/create.sql && \
|
|
|
|
gzip database/${ZBX_DB_TYPE}/create.sql && \
|
|
|
|
rm -rf /tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib/*.xml && \
|
|
|
|
cd frontends/php/ && \
|
|
|
|
patch -p3 < /tmp/font-config && \
|
|
|
|
rm -f conf/zabbix.conf.php && \
|
|
|
|
rm -rf tests && \
|
|
|
|
rm /tmp/zabbix-${ZBX_VERSION}/frontends/php/fonts/DejaVuSans.ttf && \
|
2018-05-31 09:50:32 +02:00
|
|
|
./locale/make_mo.sh
|
2018-05-29 14:23:20 +02:00
|
|
|
|
2018-07-19 12:37:11 +02:00
|
|
|
FROM ubuntu:bionic
|
2018-03-30 10:36:04 +02:00
|
|
|
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
|
|
|
|
|
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG VCS_REF
|
|
|
|
|
2018-05-31 09:50:32 +02:00
|
|
|
ARG APT_FLAGS_COMMON="-y"
|
|
|
|
ARG APT_FLAGS_PERSISTENT="${APT_FLAGS_COMMON} --no-install-recommends"
|
2018-05-30 07:44:48 +02:00
|
|
|
ARG MAJOR_VERSION=4.0
|
2019-04-18 17:51:07 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.7
|
2018-10-02 12:13:01 +02:00
|
|
|
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
|
2018-05-29 14:23:20 +02:00
|
|
|
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
|
|
|
LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm \
|
2019-01-13 23:11:40 +01:00
|
|
|
MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
|
2018-03-30 10:36:04 +02:00
|
|
|
ZBX_TYPE=server ZBX_DB_TYPE=mysql ZBX_OPT_TYPE=nginx \
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD=true ZBX_ADD_SERVER=true ZBX_ADD_WEB=true DB_SERVER_HOST=localhost MYSQL_USER=zabbix ZBX_ADD_JAVA_GATEWAY=true ZBX_JAVAGATEWAY_ENABLE=true ZBX_JAVAGATEWAY=localhost
|
2019-04-09 21:43:56 +02:00
|
|
|
ENV TINI_VERSION v0.18.0
|
2018-03-30 10:36:04 +02:00
|
|
|
|
|
|
|
LABEL org.label-schema.name="zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}-ubuntu" \
|
|
|
|
org.label-schema.vendor="Zabbix LLC" \
|
|
|
|
org.label-schema.url="https://zabbix.com/" \
|
|
|
|
org.label-schema.description="Zabbix appliance with MySQL database support and ${ZBX_OPT_TYPE} web-server" \
|
|
|
|
org.label-schema.vcs-ref="${VCS_REF}" \
|
|
|
|
org.label-schema.build-date="${BUILD_DATE}" \
|
|
|
|
org.label-schema.schema-version="1.0" \
|
2018-05-31 09:50:32 +02:00
|
|
|
org.label-schema.license="GPL v2.0" \
|
2018-05-29 14:23:20 +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-appliance -p 80:80 -p 10051:10051 -d zabbix-appliance:ubuntu-${ZBX_VERSION}"
|
2018-03-30 10:36:04 +02:00
|
|
|
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
|
2018-05-29 14:23:20 +02:00
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/src/zabbix_${ZBX_TYPE}/zabbix_${ZBX_TYPE} /usr/sbin/zabbix_${ZBX_TYPE}
|
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get
|
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender
|
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_${ZBX_TYPE}.conf /etc/zabbix/zabbix_${ZBX_TYPE}.conf
|
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/database/${ZBX_DB_TYPE}/create.sql.gz /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/create.sql.gz
|
|
|
|
|
|
|
|
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/
|
|
|
|
|
|
|
|
COPY --from=builder /tmp/zabbix-${ZBX_VERSION}/frontends/php/ /usr/share/zabbix/
|
2019-04-09 21:43:56 +02:00
|
|
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /sbin/tini
|
2018-05-29 14:23:20 +02:00
|
|
|
|
2018-07-20 05:52:59 +02:00
|
|
|
RUN apt-get ${APT_FLAGS_COMMON} update && \
|
|
|
|
apt-get ${APT_FLAGS_PERSISTENT} install locales gnupg2 && \
|
|
|
|
locale-gen $LC_ALL && \
|
2018-03-30 10:36:04 +02:00
|
|
|
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
|
|
|
addgroup --system --quiet zabbix && \
|
|
|
|
adduser --quiet \
|
|
|
|
--system --disabled-login \
|
|
|
|
--ingroup zabbix \
|
|
|
|
--home /var/lib/zabbix/ \
|
|
|
|
--no-create-home \
|
|
|
|
zabbix && \
|
|
|
|
mkdir -p /etc/zabbix && \
|
|
|
|
mkdir -p /var/lib/zabbix && \
|
|
|
|
mkdir -p /usr/lib/zabbix/alertscripts && \
|
|
|
|
mkdir -p /var/lib/zabbix/enc && \
|
|
|
|
mkdir -p /usr/lib/zabbix/externalscripts && \
|
|
|
|
mkdir -p /var/lib/zabbix/mibs && \
|
|
|
|
mkdir -p /var/lib/zabbix/modules && \
|
|
|
|
mkdir -p /var/lib/zabbix/snmptraps && \
|
|
|
|
mkdir -p /var/lib/zabbix/ssh_keys && \
|
|
|
|
mkdir -p /var/lib/zabbix/ssl && \
|
|
|
|
mkdir -p /var/lib/zabbix/ssl/certs && \
|
|
|
|
mkdir -p /var/lib/zabbix/ssl/keys && \
|
|
|
|
mkdir -p /var/lib/zabbix/ssl/ssl_ca && \
|
|
|
|
chown --quiet -R zabbix:root /var/lib/zabbix && \
|
|
|
|
mkdir -p /usr/share/doc/zabbix-${ZBX_TYPE}-${ZBX_DB_TYPE}/ && \
|
|
|
|
apt-get ${APT_FLAGS_COMMON} update && \
|
|
|
|
apt-get ${APT_FLAGS_COMMON} install \
|
2018-05-31 09:50:32 +02:00
|
|
|
wget && \
|
2018-03-30 10:36:04 +02:00
|
|
|
DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \
|
|
|
|
wget -q https://nginx.org/keys/nginx_signing.key -O- | apt-key add - && \
|
|
|
|
echo "deb http://nginx.org/packages/ubuntu/ $DISTRIB_CODENAME nginx" >> /etc/apt/sources.list.d/nginx.list && \
|
|
|
|
apt-get ${APT_FLAGS_COMMON} update && \
|
2018-05-31 09:50:32 +02:00
|
|
|
apt-get ${APT_FLAGS_PERSISTENT} install \
|
2019-01-13 00:14:00 +01:00
|
|
|
curl \
|
2018-03-30 10:36:04 +02:00
|
|
|
fping \
|
2018-07-20 05:52:59 +02:00
|
|
|
libcurl4 \
|
2018-07-20 05:56:36 +02:00
|
|
|
libevent-2.1 \
|
2018-03-30 10:36:04 +02:00
|
|
|
libiksemel3 \
|
2018-07-20 05:52:59 +02:00
|
|
|
libmysqlclient20 \
|
2018-03-30 10:36:04 +02:00
|
|
|
libopenipmi0 \
|
2018-03-30 14:37:54 +02:00
|
|
|
libpcre3 \
|
2018-03-30 10:36:04 +02:00
|
|
|
libsnmp30 \
|
|
|
|
libssh2-1 \
|
2018-07-20 05:52:59 +02:00
|
|
|
libssl1.1 \
|
2018-03-30 10:36:04 +02:00
|
|
|
libxml2 \
|
|
|
|
mysql-client \
|
2018-03-30 11:58:25 +02:00
|
|
|
mysql-server \
|
|
|
|
nginx \
|
2018-07-20 05:52:59 +02:00
|
|
|
openjdk-8-jre-headless \
|
|
|
|
php7.2-bcmath \
|
|
|
|
php7.2-fpm \
|
|
|
|
php7.2-gd \
|
|
|
|
php7.2-json \
|
|
|
|
php7.2-ldap \
|
|
|
|
php7.2-mbstring \
|
|
|
|
php7.2-mysql \
|
|
|
|
php7.2-xml \
|
2018-03-30 10:36:04 +02:00
|
|
|
snmp-mibs-downloader \
|
2018-03-30 11:58:25 +02:00
|
|
|
supervisor \
|
|
|
|
ttf-dejavu-core \
|
2019-04-12 11:34:39 +02:00
|
|
|
ca-certificates \
|
2018-05-31 09:50:32 +02:00
|
|
|
unixodbc && \
|
2018-03-30 10:36:04 +02:00
|
|
|
update-alternatives --install /usr/share/zabbix/fonts/graphfont.ttf \
|
|
|
|
zabbix-frontend-font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf 10 && \
|
|
|
|
mkdir -p /var/lib/locales/supported.d/ && \
|
|
|
|
rm -f /var/lib/locales/supported.d/local && \
|
|
|
|
cat /usr/share/zabbix/include/locales.inc.php | grep display | grep true | awk '{$1=$1};1' | \
|
|
|
|
cut -d"'" -f 2 | sort | \
|
|
|
|
xargs -I '{}' bash -c 'echo "{}.UTF-8 UTF-8" >> /var/lib/locales/supported.d/local' && \
|
2018-05-31 09:50:32 +02:00
|
|
|
dpkg-reconfigure locales && \
|
2018-03-30 10:36:04 +02:00
|
|
|
apt-get ${APT_FLAGS_COMMON} autoremove && \
|
|
|
|
apt-get ${APT_FLAGS_COMMON} clean && \
|
2018-07-20 05:52:59 +02:00
|
|
|
mkdir -p /var/lib/php7 && \
|
|
|
|
chown --quiet -R www-data:www-data /var/lib/php7 && \
|
2018-05-29 14:23:20 +02:00
|
|
|
rm -rf /var/cache/nginx/* && \
|
2019-04-09 21:43:56 +02:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
chmod +x /sbin/tini
|
2018-03-30 10:36:04 +02:00
|
|
|
|
|
|
|
EXPOSE 80/TCP 443/TCP 10051/TCP
|
|
|
|
|
|
|
|
WORKDIR /var/lib/zabbix
|
|
|
|
|
|
|
|
VOLUME ["/etc/ssl/nginx"]
|
|
|
|
VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/mibs", "/var/lib/zabbix/modules"]
|
|
|
|
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"]
|
2019-01-12 23:12:54 +01:00
|
|
|
VOLUME ["/var/lib/mysql/"]
|
2018-03-30 10:36:04 +02:00
|
|
|
|
|
|
|
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
|
|
|
COPY ["conf/etc/zabbix/nginx.conf", "/etc/zabbix/"]
|
|
|
|
COPY ["conf/etc/zabbix/nginx_ssl.conf", "/etc/zabbix/"]
|
|
|
|
COPY ["conf/etc/zabbix/web/zabbix.conf.php", "/etc/zabbix/web/"]
|
|
|
|
COPY ["conf/etc/nginx/nginx.conf", "/etc/nginx/"]
|
2018-07-20 05:52:59 +02:00
|
|
|
COPY ["conf/etc/php/7.2/fpm/conf.d/99-zabbix.ini", "/etc/php/7.2/fpm/conf.d/"]
|
2018-03-30 10:36:04 +02: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/"]
|
|
|
|
|
|
|
|
ENV ZBX_TYPE=appliance
|
|
|
|
|
2019-04-09 21:43:56 +02:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
|
|
|
|
|
|
CMD ["docker-entrypoint.sh"]
|