zabbix-docker/zabbix-appliance/rhel/Dockerfile

217 lines
9.5 KiB
Docker
Raw Normal View History

2020-08-27 20:05:12 +02:00
FROM registry.access.redhat.com/ubi8/ubi
2018-05-08 23:25:00 +02:00
MAINTAINER Alexey Pustovalov <alexey.pustovalov@zabbix.com>
2021-05-17 11:37:01 +02:00
ARG MAJOR_VERSION=6.0
2021-06-11 23:07:45 +02:00
ARG RELEASE=
2021-05-17 11:37:01 +02:00
ARG ZBX_VERSION=${MAJOR_VERSION}
2020-08-27 20:05:12 +02:00
2019-05-10 16:11:07 +02:00
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
2020-08-27 20:05:12 +02:00
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
2018-05-08 23:25:00 +02:00
LABEL name="zabbix/zabbix-appliance" \
maintainer="alexey.pustovalov@zabbix.com" \
vendor="Zabbix LLC" \
version="${MAJOR_VERSION}" \
release="${RELEASE}" \
2020-08-27 20:05:12 +02:00
summary="Zabbix appliance with MySQL database support and Nginx web-server" \
2018-05-08 23:25:00 +02:00
description="Zabbix appliance contains MySQL database server, Zabbix server, Zabbix Java Gateway and Zabbix frontend based on Nginx web-server." \
url="https://www.zabbix.com/" \
2021-06-11 23:07:45 +02:00
run="docker run --name zabbix-appliance -p 80:8080 -p 10051:10051 -d registry.connect.redhat.com/zabbix/zabbix-appliance-trunk:${ZBX_VERSION}" \
2020-08-27 20:05:12 +02:00
io.k8s.description="Zabbix appliance with MySQL database support and Nginx web-server" \
2018-05-08 23:25:00 +02:00
io.k8s.display-name="Zabbix Appliance" \
2020-08-27 20:05:12 +02:00
io.openshift.expose-services="8080:http,8443:https,10051:10051" \
2018-05-08 23:25:00 +02:00
io.openshift.tags="zabbix,zabbix-appliance,mysql,nginx" \
org.label-schema.name="zabbix-appliance-rhel" \
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \
2020-08-27 20:05:12 +02:00
org.label-schema.description="Zabbix appliance with MySQL database support and Nginx web-server" \
2018-05-08 23:25:00 +02:00
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-08 23:25:00 +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}" \
2021-06-11 23:07:45 +02:00
org.label-schema.docker.cmd="docker run --name zabbix-appliance -p 80:8080 -p 10051:10051 -d registry.connect.redhat.com/zabbix/zabbix-appliance-trunk:${ZBX_VERSION}"
2018-05-08 23:25:00 +02:00
STOPSIGNAL SIGTERM
COPY ["licenses", "/licenses"]
2020-08-27 20:05:12 +02:00
RUN set -o xtrace && INSTALL_PKGS="OpenIPMI-libs \
2021-06-11 23:07:45 +02:00
tzdata \
2019-01-13 00:14:00 +01:00
curl \
2018-05-08 23:25:00 +02:00
fping \
java-1.8.0-openjdk-headless \
2020-08-27 20:05:12 +02:00
pcre \
2018-05-08 23:25:00 +02:00
libcurl \
2020-08-27 20:05:12 +02:00
libssh \
2018-05-08 23:25:00 +02:00
libevent \
libxml2 \
mariadb \
mariadb-server \
net-snmp-libs \
nginx \
openldap \
openssl-libs \
pcre \
php-bcmath \
php-fpm \
php-gd \
2020-08-27 20:05:12 +02:00
php-json \
2018-05-08 23:25:00 +02:00
php-ldap \
php-mbstring \
2020-08-27 20:05:12 +02:00
php-mysqlnd \
2018-05-08 23:25:00 +02:00
php-xml \
2021-06-11 23:07:45 +02:00
supervisor \
2018-05-08 23:25:00 +02:00
unixODBC" && \
2021-06-11 23:07:45 +02:00
REPOLIST="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,epel" && \
2020-08-27 20:05:12 +02:00
dnf -y update-minimal --disablerepo "*" --enablerepo ubi-8-baseos --setopt=tsflags=nodocs \
--security --sec-severity=Important --sec-severity=Critical && \
2021-06-11 23:07:45 +02:00
dnf -y module enable php:7.4 nginx:1.18 && \
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
2020-08-27 20:05:12 +02:00
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
--setopt=tsflags=nodocs ${INSTALL_PKGS} && \
groupadd --system --gid 1995 zabbix && \
useradd \
--system --comment "Zabbix monitoring system" \
-g zabbix -G root,dialout \
--uid 1997 \
--shell /sbin/nologin \
--home-dir /var/lib/zabbix/ \
2018-05-08 23:25:00 +02:00
zabbix && \
mkdir -p /etc/zabbix && \
2021-06-11 23:07:45 +02:00
mkdir -p /etc/zabbix/web && \
mkdir -p /etc/zabbix/web/certs && \
2018-05-08 23:25:00 +02:00
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 && \
2020-08-27 20:05:12 +02:00
mkdir -p /usr/share/zabbix/ && \
mkdir -p /usr/sbin/zabbix_java/ && \
2021-06-11 23:07:45 +02:00
mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \
2018-05-08 23:25:00 +02:00
mkdir -p /var/lib/php/ && \
2020-08-27 20:05:12 +02:00
mkdir -p /usr/share/doc/zabbix-server-mysql/ && \
dnf -y clean all && \
rm -f /etc/php-fpm.d/www.conf /etc/nginx/conf.d/*.conf /etc/my.cnf.d/auth_gssapi.cnf && \
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-08 23:25:00 +02:00
2020-08-27 20:05:12 +02:00
COPY ["conf/etc/", "/etc/"]
RUN set -eux && REPOLIST="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,codeready-builder-for-rhel-8-x86_64-rpms" && \
2018-05-08 23:25:00 +02:00
INSTALL_PKGS="autoconf \
automake \
gcc \
gettext \
2020-08-27 20:05:12 +02:00
glibc-locale-source \
2018-05-08 23:25:00 +02:00
java-1.8.0-openjdk-devel \
libcurl-devel \
libevent-devel \
2020-08-27 20:05:12 +02:00
libssh-devel \
2018-05-08 23:25:00 +02:00
libxml2-devel \
make \
2020-08-27 20:05:12 +02:00
mariadb-connector-c-devel \
pcre-devel \
2018-05-08 23:25:00 +02:00
net-snmp-devel \
OpenIPMI-devel \
openldap-devel \
2019-05-10 16:11:07 +02:00
git \
2018-05-08 23:25:00 +02:00
unixODBC-devel" && \
2020-08-27 20:05:12 +02:00
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
--setopt=tsflags=nodocs ${INSTALL_PKGS} && \
2018-05-08 23:25:00 +02:00
cd /tmp/ && \
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \
2018-05-08 23:25:00 +02:00
cd /tmp/zabbix-${ZBX_VERSION} && \
2019-05-10 16:11:07 +02:00
zabbix_revision=`git rev-parse --short HEAD` && \
2018-05-08 23:25:00 +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-08 23:25:00 +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 \
2020-08-27 20:05:12 +02:00
--enable-server \
--with-mysql \
2018-05-08 23:25:00 +02:00
--with-ldap \
--with-libcurl \
--with-libxml2 \
--enable-java \
--with-net-snmp \
--with-openipmi \
--with-openssl \
2020-08-27 20:05:12 +02:00
--with-ssh \
2018-05-08 23:25:00 +02:00
--with-unixodbc \
--enable-ipv6 \
--silent && \
make -j"$(nproc)" -s dbschema && \
make -j"$(nproc)" -s && \
2020-08-27 20:05:12 +02:00
cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \
2018-05-08 23:25:00 +02:00
cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
2020-08-27 20:05:12 +02:00
cp conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf && \
cat database/mysql/schema.sql > database/mysql/create.sql && \
cat database/mysql/images.sql >> database/mysql/create.sql && \
cat database/mysql/data.sql >> database/mysql/create.sql && \
gzip database/mysql/create.sql && \
cp database/mysql/create.sql.gz /usr/share/doc/zabbix-server-mysql/ && \
2018-05-08 23:25:00 +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 && \
2020-08-27 20:05:12 +02:00
cp -R /tmp/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \
2018-05-08 23:25:00 +02:00
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
2020-08-27 20:05:12 +02:00
rm -f /usr/share/zabbix/conf/zabbix.conf.php && \
rm -rf /usr/share/zabbix/tests/ && \
2018-05-08 23:25:00 +02:00
cd /usr/share/zabbix/ && \
./locale/make_mo.sh && \
2021-06-07 18:35:20 +02:00
rm -f conf/zabbix.conf.php conf/maintenance.inc.php conf/zabbix.conf.php.example && \
rm -rf tests && \
rm -f locale/add_new_language.sh locale/update_po.sh locale/make_mo.sh && \
2020-08-27 20:05:12 +02:00
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
2021-06-11 23:07:45 +02:00
ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \
2020-08-27 20:05:12 +02:00
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 "{}" && localedef -c -i {} -f UTF-8 {}.UTF-8 2>/dev/null' && \
chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ /usr/share/zabbix/conf/ && \
chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ /usr/share/zabbix/conf/ && \
chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ /usr/share/zabbix/conf/ && \
chown --quiet -R zabbix:root /etc/nginx/ /etc/my.cnf.d/ /etc/my.cnf /etc/php-fpm.d/ /etc/php-fpm.conf && \
chgrp -R 0 /etc/nginx/ /etc/my.cnf.d/ /etc/my.cnf /etc/php-fpm.d/ /etc/php-fpm.conf && \
chmod -R g=u /etc/nginx/ /etc/my.cnf.d/ /etc/my.cnf /etc/php-fpm.d/ /etc/php-fpm.conf && \
chown --quiet -R zabbix:root /var/lib/mysql/ /var/lib/php/session/ && \
chgrp -R 0 /var/lib/mysql/ /var/lib/php/session/ && \
chmod -R g=u /var/lib/mysql/ /var/lib/php/session/ && \
2021-06-11 23:07:45 +02:00
chown --quiet -R zabbix:root /usr/share/zabbix/include/defines.inc.php && \
chgrp -R 0 /usr/share/zabbix/include/defines.inc.php && \
chmod -R g=u /usr/share/zabbix/include/defines.inc.php && \
dnf -y history undo last && \
2020-08-27 20:05:12 +02:00
dnf -y clean all && \
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-08 23:25:00 +02:00
2020-08-27 20:05:12 +02:00
EXPOSE 8080/TCP 8443/TCP 10051/TCP
2018-05-08 23:25:00 +02:00
WORKDIR /var/lib/zabbix
2020-08-27 20:05:12 +02:00
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/export"]
2018-05-08 23:25:00 +02:00
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"]
2020-08-27 20:05:12 +02:00
USER 1997
2018-05-08 23:25:00 +02:00
2021-06-11 23:07:45 +02:00
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]