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
|
2024-09-23 10:49:22 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.44
|
2021-09-13 00:06:51 +02:00
|
|
|
ARG BUILD_BASE_IMAGE=zabbix-build-base:alpine-${ZBX_VERSION}
|
|
|
|
|
2024-05-30 11:38:31 +02:00
|
|
|
FROM ${BUILD_BASE_IMAGE} AS builder
|
2021-09-13 00:06:51 +02:00
|
|
|
|
|
|
|
ARG MAJOR_VERSION
|
|
|
|
ARG ZBX_VERSION
|
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
2024-05-13 08:42:31 +02:00
|
|
|
ARG GIT_BRANCH
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2024-08-15 09:48:24 +02:00
|
|
|
ARG CFLAGS
|
|
|
|
|
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 PostgreSQL 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 (PostgreSQL)" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
2024-05-21 12:45:53 +02:00
|
|
|
org.opencontainers.image.vendor="Zabbix SIA" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}"
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2024-06-01 08:10:31 +02:00
|
|
|
ENV ZBX_SOURCES_DIR=/tmp/zabbix-${ZBX_VERSION} ZBX_OUTPUT_DIR=/tmp/zabbix-${ZBX_VERSION}-output \
|
2024-08-15 09:48:24 +02:00
|
|
|
DB_TYPE=postgresql \
|
|
|
|
CFLAGS=${CFLAGS:-"-fPIC -pie -Wl,-z,relro,-z,now,-z,defs -D_FORTIFY_SOURCE=2 -fexceptions -O2 -pipe"}
|
2024-06-01 08:10:31 +02:00
|
|
|
|
2024-02-20 09:24:36 +01:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build/ \
|
|
|
|
--mount=type=cache,target=/root/go/ \
|
2024-08-14 09:40:30 +02:00
|
|
|
--mount=type=bind,source=src/,target=/tmp/src \
|
2024-02-20 09:24:36 +01:00
|
|
|
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 11:10:47 +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/ && \
|
2024-06-01 08:10:31 +02:00
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/agent/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/agent/conf/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/proxy/conf/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/proxy/database/${DB_TYPE}/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/server/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/server/conf/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/server/database/${DB_TYPE}/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/java_gateway/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/general/sbin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/general/bin/ && \
|
|
|
|
mkdir -p ${ZBX_OUTPUT_DIR}/general/conf/ && \
|
2024-08-14 09:40:30 +02:00
|
|
|
if [ -f "/tmp/src/bootstrap.sh" ]; then \
|
|
|
|
cp -R /tmp/src ${ZBX_SOURCES_DIR}; \
|
|
|
|
else \
|
|
|
|
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${GIT_BRANCH:-$ZBX_VERSION} --depth 1 --single-branch ${ZBX_SOURCES_DIR}; \
|
|
|
|
fi && \
|
2024-06-01 08:10:31 +02:00
|
|
|
cd ${ZBX_SOURCES_DIR} && \
|
2021-09-13 00:06:51 +02:00
|
|
|
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 && \
|
|
|
|
./configure \
|
|
|
|
--datadir=/usr/lib \
|
|
|
|
--libdir=/usr/lib/zabbix \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc/zabbix \
|
2024-08-15 09:48:24 +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 \
|
2024-08-15 09:48:24 +02:00
|
|
|
--with-${DB_TYPE} \
|
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 && \
|
2024-06-01 08:10:31 +02:00
|
|
|
cat database/${DB_TYPE}/schema.sql > database/${DB_TYPE}/create.sql && \
|
|
|
|
gzip -c database/${DB_TYPE}/create.sql > ${ZBX_OUTPUT_DIR}/proxy/database/${DB_TYPE}/create.sql.gz && \
|
|
|
|
cat database/${DB_TYPE}/images.sql >> database/${DB_TYPE}/create.sql && \
|
|
|
|
cat database/${DB_TYPE}/data.sql >> database/${DB_TYPE}/create.sql && \
|
|
|
|
gzip -c database/${DB_TYPE}/create.sql > ${ZBX_OUTPUT_DIR}/server/database/${DB_TYPE}/create.sql.gz && \
|
|
|
|
rm -rf database/${DB_TYPE}/create.sql && \
|
|
|
|
cp -R ${ZBX_SOURCES_DIR}/database/postgresql/timescaledb.sql ${ZBX_OUTPUT_DIR}/server/database/${DB_TYPE}/timescaledb.sql && \
|
2023-03-14 13:15:10 +01:00
|
|
|
mkdir /tmp/fonts/ && \
|
2024-08-26 18:02:32 +02:00
|
|
|
curl --tlsv1.2 -sSf -L "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip" -o /tmp/fonts/NotoSansCJKjp-hinted.zip && \
|
2023-03-14 13:15:10 +01:00
|
|
|
unzip /tmp/fonts/NotoSansCJKjp-hinted.zip -d /tmp/fonts/ && \
|
2024-06-01 08:10:31 +02:00
|
|
|
cp /tmp/fonts/NotoSansCJKjp-Regular.otf ${ZBX_SOURCES_DIR}/ui/assets/fonts/NotoSansCJKjp-Regular.ttf && \
|
|
|
|
cp /tmp/fonts/LICENSE_OFL.txt ${ZBX_SOURCES_DIR}/ui/assets/fonts/ && \
|
|
|
|
rm -f ${ZBX_SOURCES_DIR}/ui/assets/fonts/DejaVuSans.ttf && \
|
|
|
|
sed -i -r "s/(define\(.*_FONT_NAME.*)DejaVuSans/\1NotoSansCJKjp-Regular/" ${ZBX_SOURCES_DIR}/ui/include/defines.inc.php && \
|
2023-03-14 13:15:10 +01:00
|
|
|
rm -rf /tmp/fonts/ && \
|
2024-06-01 08:10:31 +02:00
|
|
|
chmod o+r ${ZBX_SOURCES_DIR}/ui/assets/fonts/* && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/zabbix_agent/zabbix_agentd && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/zabbix_server/zabbix_server && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/zabbix_proxy/zabbix_proxy && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/go/bin/zabbix_agent2 && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/zabbix_get/zabbix_get && \
|
|
|
|
strip ${ZBX_SOURCES_DIR}/src/zabbix_sender/zabbix_sender && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/zabbix_agent/zabbix_agentd ${ZBX_OUTPUT_DIR}/agent/sbin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/conf/zabbix_agentd.conf ${ZBX_OUTPUT_DIR}/agent/conf/ && \
|
|
|
|
cp -R ${ZBX_SOURCES_DIR}/conf/zabbix_agentd/ ${ZBX_OUTPUT_DIR}/agent/conf/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/go/bin/zabbix_agent2 ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/go/conf/zabbix_agent2.conf ${ZBX_OUTPUT_DIR}/agent2/conf/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/zabbix_server/zabbix_server ${ZBX_OUTPUT_DIR}/server/sbin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/conf/zabbix_server.conf ${ZBX_OUTPUT_DIR}/server/conf/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/zabbix_proxy/zabbix_proxy ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/conf/zabbix_proxy.conf ${ZBX_OUTPUT_DIR}/proxy/conf/ && \
|
|
|
|
cp -R ${ZBX_SOURCES_DIR}/src/zabbix_java/bin/ ${ZBX_OUTPUT_DIR}/java_gateway/sbin/ && \
|
|
|
|
cp -R ${ZBX_SOURCES_DIR}/src/zabbix_java/lib/ ${ZBX_OUTPUT_DIR}/java_gateway/sbin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/zabbix_get/zabbix_get ${ZBX_OUTPUT_DIR}/general/bin/ && \
|
|
|
|
cp ${ZBX_SOURCES_DIR}/src/zabbix_sender/zabbix_sender ${ZBX_OUTPUT_DIR}/general/bin/ && \
|
|
|
|
make -s distclean
|