zabbix-docker/Dockerfiles/zabbix-appliance/rhel/Dockerfile

220 lines
9.7 KiB
Docker
Raw Normal View History

FROM registry.access.redhat.com/ubi8/ubi
2018-05-08 23:25:00 +02:00
2019-11-14 06:28:37 +01:00
ARG MAJOR_VERSION=5.0
2022-06-27 16:11:09 +02:00
ARG RELEASE=25
ARG ZBX_VERSION=${MAJOR_VERSION}.25
2019-05-10 16:11:07 +02:00
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
2021-10-16 17:49:19 +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}" \
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/" \
run="docker run --name zabbix-appliance -p 80:8080 -p 10051:10051 -d registry.connect.redhat.com/zabbix/zabbix-appliance-50:${ZBX_VERSION}" \
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" \
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/" \
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}" \
org.label-schema.docker.cmd="docker run --name zabbix-appliance -p 80:8080 -p 10051:10051 -d registry.connect.redhat.com/zabbix/zabbix-appliance-50:${ZBX_VERSION}"
2018-05-08 23:25:00 +02:00
STOPSIGNAL SIGTERM
COPY ["licenses", "/licenses"]
RUN set -o xtrace && INSTALL_PKGS="OpenIPMI-libs \
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 \
pcre \
2018-05-08 23:25:00 +02:00
libcurl \
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 \
php-json \
2018-05-08 23:25:00 +02:00
php-ldap \
php-mbstring \
php-mysqlnd \
2018-05-08 23:25:00 +02:00
php-xml \
2021-06-11 20:20:13 +02:00
supervisor \
2018-05-08 23:25:00 +02:00
unixODBC" && \
2021-06-11 20:20:13 +02:00
REPOLIST="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,epel" && \
dnf -y update-minimal --disablerepo "*" --enablerepo ubi-8-baseos --setopt=tsflags=nodocs \
--security --sec-severity=Important --sec-severity=Critical && \
2021-06-11 20:20:13 +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 && \
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 && \
2020-09-11 08:49:29 +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 && \
mkdir -p /usr/share/zabbix/ && \
mkdir -p /usr/sbin/zabbix_java/ && \
2020-09-01 23:45:40 +02:00
mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \
2018-05-08 23:25:00 +02:00
mkdir -p /var/lib/php/ && \
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
COPY ["conf/etc/", "/etc/"]
2018-05-08 23:25:00 +02:00
2021-06-11 20:20:13 +02:00
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 \
glibc-locale-source \
2018-05-08 23:25:00 +02:00
java-1.8.0-openjdk-devel \
libcurl-devel \
libevent-devel \
libssh-devel \
2018-05-08 23:25:00 +02:00
libxml2-devel \
make \
mariadb-connector-c-devel \
pcre-devel \
2018-05-08 23:25:00 +02:00
net-snmp-devel \
2021-06-11 20:20:13 +02:00
OpenIPMI-devel \
2018-05-08 23:25:00 +02:00
openldap-devel \
2019-05-10 16:11:07 +02:00
git \
2018-05-08 23:25:00 +02:00
unixODBC-devel" && \
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 ${ZBX_VERSION} --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 \
--enable-server \
--with-mysql \
2018-05-08 23:25:00 +02:00
--with-ldap \
--with-libcurl \
--with-libxml2 \
--enable-java \
--with-net-snmp \
2021-06-11 20:20:13 +02:00
--with-openipmi \
2018-05-08 23:25:00 +02:00
--with-openssl \
--with-ssh \
2018-05-08 23:25:00 +02:00
--with-unixodbc \
--enable-ipv6 \
--silent && \
make -j"$(nproc)" -s dbschema && \
make -j"$(nproc)" -s && \
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 && \
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/ && \
2021-09-13 17:59:35 +02:00
rm -rf /usr/sbin/zabbix_java/lib/logback.xml && \
mv /usr/sbin/zabbix_java/lib/logback-console.xml /etc/zabbix/zabbix_java_gateway_logback.xml && \
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}/ && \
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:33:10 +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 && \
2021-10-14 23:27:40 +02:00
find /usr/share/zabbix/locale -name '*.po' | xargs rm -f && \
find /usr/share/zabbix/locale -name '*.sh' | xargs rm -f && \
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" && \
ln -s "/etc/zabbix/web/maintenance.inc.php" "/usr/share/zabbix/conf/maintenance.inc.php" && \
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/ && \
2020-09-01 23:45:40 +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 && \
2021-06-11 20:20:13 +02:00
dnf -y history undo last && \
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
EXPOSE 8080/TCP 8443/TCP 10051/TCP
2018-05-08 23:25:00 +02:00
WORKDIR /var/lib/zabbix
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/"]
USER 1997
2018-05-08 23:25:00 +02:00
2021-06-11 20:20:13 +02:00
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]