zabbix-docker/Dockerfiles/build-mysql/rhel/Dockerfile

83 lines
3.5 KiB
Docker
Raw Normal View History

# syntax=docker/dockerfile:1
ARG MAJOR_VERSION=6.0
2021-10-16 17:49:19 +02:00
ARG RELEASE=
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG BUILD_BASE_IMAGE=zabbix-build-base:rhel-${ZBX_VERSION}
FROM ${BUILD_BASE_IMAGE} as builder
ARG MAJOR_VERSION
ARG RELEASE
ARG ZBX_VERSION
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
2021-10-16 17:49:19 +02:00
LABEL description="Zabbix build base for MySQL based images" \
maintainer="alexey.pustovalov@zabbix.com" \
2021-10-16 17:49:19 +02:00
name="zabbix/zabbix-build-mysql-trunk" \
release="${RELEASE}" \
summary="Zabbix build base (MySQL)" \
url="https://www.zabbix.com/" \
2021-10-16 17:49:19 +02:00
vendor="Zabbix LLC" \
version="${MAJOR_VERSION}" \
io.k8s.description="Zabbix build base for MySQL based images" \
io.k8s.display-name="Zabbix build base (MySQL)" \
io.openshift.expose-services="" \
io.openshift.tags="zabbix,build,mysql" \
2021-10-16 17:49:19 +02:00
org.label-schema.description="Zabbix build base for MySQL based images" \
org.label-schema.name="zabbix-build-mysql-rhel" \
org.label-schema.url="https://zabbix.com/" \
2021-10-16 17:49:19 +02:00
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.vendor="Zabbix LLC"
RUN set -eux && \
cd /tmp/ && \
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \
cd /tmp/zabbix-${ZBX_VERSION} && \
zabbix_revision=`git rev-parse --short HEAD` && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \
./bootstrap.sh && \
export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \
./configure \
--datadir=/usr/lib \
--libdir=/usr/lib/zabbix \
--prefix=/usr \
--sysconfdir=/etc/zabbix \
2021-10-16 17:49:19 +02:00
--enable-ipv6 \
--enable-agent \
--enable-agent2 \
2021-10-16 17:49:19 +02:00
--enable-java \
--enable-proxy \
2021-10-16 17:49:19 +02:00
--enable-server \
--enable-webservice \
--with-ldap \
--with-libcurl \
2021-10-16 17:49:19 +02:00
# --with-libmodbus \
--with-libxml2 \
2021-10-16 17:49:19 +02:00
--with-mysql \
--with-net-snmp \
--with-openipmi \
--with-openssl \
--with-ssh \
--with-unixodbc \
--silent && \
make -j"$(nproc)" -s dbschema && \
make -j"$(nproc)" -s && \
make -j"$(nproc)" -s gettext && \
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 -c database/mysql/create.sql > database/mysql/create_server.sql.gz && \
rm -rf database/mysql/create.sql && \
cat database/mysql/schema.sql > database/mysql/create.sql && \
gzip -c database/mysql/create.sql > database/mysql/create_proxy.sql.gz && \
rm -rf database/mysql/create.sql && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \
strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender && \
strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_web_service