2021-09-13 00:06:51 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
2021-10-12 01:41:42 +02:00
|
|
|
ARG MAJOR_VERSION=5.0
|
2022-05-30 16:54:11 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.24
|
2021-09-13 00:06:51 +02:00
|
|
|
ARG BUILD_BASE_IMAGE=zabbix-build-base:ubuntu-${ZBX_VERSION}
|
|
|
|
|
|
|
|
FROM ${BUILD_BASE_IMAGE} as builder
|
|
|
|
|
|
|
|
ARG MAJOR_VERSION
|
|
|
|
ARG ZBX_VERSION
|
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
2021-09-13 00:06:51 +02:00
|
|
|
org.opencontainers.image.description="Zabbix build base for MySQL based images" \
|
|
|
|
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.licenses="GPL v2.0" \
|
|
|
|
org.opencontainers.image.source="${ZBX_SOURCES}" \
|
|
|
|
org.opencontainers.image.title="Zabbix build base (MySQL)" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
|
|
|
org.opencontainers.image.vendor="Zabbix LLC" \
|
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}"
|
2021-09-13 00:06:51 +02:00
|
|
|
|
|
|
|
RUN set -eux && \
|
2021-10-27 21:28:33 +02:00
|
|
|
ARCH_SUFFIX="$(arch)"; \
|
|
|
|
case "$ARCH_SUFFIX" in \
|
|
|
|
x86_64) \
|
|
|
|
additional_components='--enable-java'; \
|
|
|
|
;; \
|
|
|
|
aarch64) \
|
|
|
|
additional_components='--enable-java'; \
|
|
|
|
;; \
|
|
|
|
armv7l) \
|
|
|
|
additional_components='--enable-java'; \
|
|
|
|
;; \
|
2021-10-28 00:45:54 +02:00
|
|
|
s390x) \
|
|
|
|
additional_components='--enable-java'; \
|
|
|
|
;; \
|
2021-10-27 21:28:33 +02:00
|
|
|
ppc64le) \
|
|
|
|
additional_components=''; \
|
|
|
|
;; \
|
|
|
|
*) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \
|
|
|
|
esac; \
|
2021-09-13 00:06:51 +02:00
|
|
|
cd /tmp/ && \
|
2021-10-12 01:41:42 +02:00
|
|
|
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \
|
2021-09-13 00:06:51 +02:00
|
|
|
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 \
|
2021-09-13 00:06:51 +02:00
|
|
|
--enable-agent \
|
|
|
|
--enable-agent2 \
|
|
|
|
--enable-proxy \
|
2021-10-16 17:49:19 +02:00
|
|
|
--enable-server \
|
2021-09-13 00:06:51 +02:00
|
|
|
--with-ldap \
|
|
|
|
--with-libcurl \
|
|
|
|
--with-libxml2 \
|
2021-10-16 17:49:19 +02:00
|
|
|
--with-mysql \
|
2021-09-13 00:06:51 +02:00
|
|
|
--with-net-snmp \
|
|
|
|
--with-openipmi \
|
|
|
|
--with-openssl \
|
|
|
|
--with-ssh \
|
|
|
|
--with-unixodbc \
|
2021-10-27 21:28:33 +02:00
|
|
|
$additional_components \
|
2021-09-13 00:06:51 +02:00
|
|
|
--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 && \
|
2021-10-12 17:01:21 +02:00
|
|
|
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender
|