zabbix-docker/zabbix-appliance/rhel/Dockerfile

222 lines
10 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>
2020-08-27 20:05:12 +02:00
ARG MAJOR_VERSION=5.2
ARG RELEASE=0
2020-08-27 20:05:12 +02:00
ARG ZBX_VERSION=${MAJOR_VERSION}.0
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
ENV TINI_VERSION=v0.19.0
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/" \
2020-08-27 20:05:12 +02:00
run="docker run --name zabbix-appliance -p 80:8080 -p 10051:10051 -d registry.connect.redhat.com/zabbix/zabbix-appliance-52:${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" \
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}" \
2020-08-27 20:05:12 +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-52:${ZBX_VERSION}"
2018-05-08 23:25:00 +02:00
STOPSIGNAL SIGTERM
COPY ["conf/etc/yum.repo.d/nginx.repo", "/etc/yum.repos.d/nginx.repo"]
COPY ["licenses", "/licenses"]
2020-08-27 20:05:12 +02:00
RUN set -o xtrace && INSTALL_PKGS="OpenIPMI-libs \
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 \
2020-08-27 20:05:12 +02:00
python3-pip \
2018-05-08 23:25:00 +02:00
unixODBC" && \
2020-08-27 20:05:12 +02:00
dnf -y install --disableplugin=subscription-manager --disablerepo "*" \
https://repo.zabbix.com/zabbix/${MAJOR_VERSION}/rhel/8/x86_64/zabbix-release-${MAJOR_VERSION}-1.el8.noarch.rpm && \
REPOLIST="rhel-8-for-x86_64-baseos-rpms,rhel-8-for-x86_64-appstream-rpms,zabbix-non-supported,nginx-stable" && \
dnf -y update-minimal --disablerepo "*" --enablerepo ubi-8-baseos --setopt=tsflags=nodocs \
--security --sec-severity=Important --sec-severity=Critical && \
dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \
--setopt=tsflags=nodocs ${INSTALL_PKGS} && \
pip3 install supervisor && \
ln -s /usr/local/bin/supervisord /usr/bin/supervisord && \
groupadd -g 1995 --system zabbix && \
2018-05-08 23:25:00 +02:00
adduser -r --shell /sbin/nologin \
2020-08-27 20:05:12 +02:00
-g zabbix -G dialout -G root \
-d /var/lib/zabbix/ -u 1997 \
2018-05-08 23:25:00 +02:00
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 && \
2020-08-27 20:05:12 +02:00
mkdir -p /usr/share/zabbix/ && \
mkdir -p /usr/sbin/zabbix_java/ && \
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/ && \
curl -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini -o /sbin/tini && \
curl -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc -o /tmp/tini.asc && \
export GNUPGHOME="$(mktemp -d)" && \
for server in $(shuf -e ha.pool.sks-keyservers.net \
hkp://p80.pool.sks-keyservers.net:80 \
ipv4.pool.sks-keyservers.net \
keyserver.ubuntu.com \
keyserver.pgp.com \
pgp.mit.edu) ; do \
gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \
done && \
gpg --batch --verify /tmp/tini.asc /sbin/tini && \
2020-08-29 11:23:51 +02:00
rm -rf "$GNUPGHOME" /tmp/tini.asc && \
2020-08-27 20:05:12 +02:00
chmod +x /sbin/tini && \
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" && \
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 \
2020-08-27 20:05:12 +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" && \
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/ && \
2020-08-27 20:05:12 +02:00
git 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" 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 \
2020-08-27 20:05:12 +02:00
# --with-openipmi \
2018-05-08 23:25:00 +02:00
--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 && \
2020-08-27 20:05:12 +02:00
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.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/ && \
dnf -y history undo `dnf history list last -q | sed -n 3p |column -t | cut -d' ' -f1` && \
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
2020-08-27 20:05:12 +02:00
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]