From 2b7d26b4cabd5664d4d9523109c1e0e11708696b Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Mon, 13 Sep 2021 03:35:17 +0200 Subject: [PATCH] Dedicated build environment for Oracle Linux based images --- agent/centos/Dockerfile | 1 + agent/ol/Dockerfile | 89 +++++-------- agent2/ol/Dockerfile | 121 +++++------------- build-base/ol/.dockerignore | 1 + build-base/ol/Dockerfile | 76 +++++++++++ build-base/ol/build.sh | 1 + .../conf/etc/yum.repos.d/oracle-epel-ol8.repo | 6 + build-mysql/ol/.dockerignore | 1 + build-mysql/ol/Dockerfile | 70 ++++++++++ build-mysql/ol/build.sh | 1 + build-pgsql/ol/.dockerignore | 1 + build-pgsql/ol/Dockerfile | 71 ++++++++++ build-pgsql/ol/build.sh | 1 + build-sqlite3/alpine/Dockerfile | 12 +- build-sqlite3/ol/.dockerignore | 1 + build-sqlite3/ol/Dockerfile | 58 +++++++++ build-sqlite3/ol/build.sh | 1 + docker-compose_v3_ol_mysql_local.yaml | 56 ++++++++ docker-compose_v3_ol_pgsql_local.yaml | 67 ++++++++++ java-gateway/ol/Dockerfile | 85 +++++------- proxy-mysql/ol/Dockerfile | 113 +++++----------- proxy-sqlite3/ol/Dockerfile | 111 +++++----------- server-mysql/ol/Dockerfile | 116 +++++------------ server-pgsql/ol/Dockerfile | 117 +++++------------ web-apache-mysql/ol/Dockerfile | 73 +++++------ web-apache-pgsql/ol/Dockerfile | 77 +++++------ web-nginx-mysql/ol/Dockerfile | 70 +++++----- web-nginx-pgsql/ol/Dockerfile | 73 +++++------ web-service/ol/Dockerfile | 80 ++++-------- 29 files changed, 786 insertions(+), 764 deletions(-) create mode 100644 build-base/ol/.dockerignore create mode 100644 build-base/ol/Dockerfile create mode 120000 build-base/ol/build.sh create mode 100644 build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo create mode 100644 build-mysql/ol/.dockerignore create mode 100644 build-mysql/ol/Dockerfile create mode 120000 build-mysql/ol/build.sh create mode 100644 build-pgsql/ol/.dockerignore create mode 100644 build-pgsql/ol/Dockerfile create mode 120000 build-pgsql/ol/build.sh create mode 100644 build-sqlite3/ol/.dockerignore create mode 100644 build-sqlite3/ol/Dockerfile create mode 120000 build-sqlite3/ol/build.sh diff --git a/agent/centos/Dockerfile b/agent/centos/Dockerfile index 7e084cec8..c44987c5a 100644 --- a/agent/centos/Dockerfile +++ b/agent/centos/Dockerfile @@ -41,6 +41,7 @@ RUN set -eux && \ zlib \ tzdata \ openssl-libs && \ + dnf -y upgrade && \ curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}" -o /sbin/tini && \ curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH_SUFFIX}.asc" -o /tmp/tini.asc && \ export GNUPGHOME="$(mktemp -d)" && \ diff --git a/agent/ol/Dockerfile b/agent/ol/Dockerfile index ed51c21ba..0d20516d8 100644 --- a/agent/ol/Dockerfile +++ b/agent/ol/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd", "/usr/sbin/zabbix_agentd"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf", "/etc/zabbix/zabbix_agentd.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -36,70 +57,18 @@ RUN set -eux && \ libcurl \ openssl-libs \ zlib" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - pcre-devel \ - libcurl-devel \ - make \ - openssl-devel \ - openldap-devel \ - git \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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 && \ - ./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 \ - --prefix=/usr \ - --enable-agent \ - --with-libcurl \ - --with-ldap \ - --with-openssl \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd /usr/sbin/zabbix_agentd && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + microdnf -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 diff --git a/agent2/ol/Dockerfile b/agent2/ol/Dockerfile index 6b9b5f6e9..077e377cc 100644 --- a/agent2/ol/Dockerfile +++ b/agent2/ol/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix agent 2" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2", "/usr/sbin/zabbix_agent2"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf", "/etc/zabbix/zabbix_agent2.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -26,9 +47,6 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/enc && \ mkdir -p /var/lib/zabbix/modules && \ mkdir -p /var/lib/zabbix/buffer && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ INSTALL_PKGS="bash \ tini \ tzdata \ @@ -36,99 +54,18 @@ RUN set -eux && \ pcre \ libcurl \ openssl-libs" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - PATH=/usr/local/go/bin:$PATH && \ - INSTALL_PKGS="autoconf \ - automake \ - pcre-devel \ - libcurl-devel \ - make \ - openssl-devel \ - openldap-devel \ - git \ - wget \ - tar \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - ARCH_SUFFIX="$(arch)"; \ - case "$ARCH_SUFFIX" in \ - x86_64) \ - url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ - sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ - ;; \ - aarch64) \ - url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ - sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ - ;; \ - *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ - esac; \ - wget -O go.tgz.asc "$url.asc" && \ - wget -O go.tgz "$url" --progress=dot:giga && \ - echo "$sha256 *go.tgz" | sha256sum -c - && \ - GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ - gpg --batch --verify go.tgz.asc go.tgz && \ - gpgconf --kill all && \ - rm -rf "$GNUPGHOME" go.tgz.asc && \ - tar -C /usr/local -xzf go.tgz && \ - rm go.tgz && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - export GOPATH=/tmp/zabbix-${ZBX_VERSION}/go && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --prefix=/usr \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --with-openssl \ - --enable-ipv6 \ - --enable-agent2 \ - --enable-agent \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 /usr/sbin/zabbix_agent2 && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf && \ - strip /usr/sbin/zabbix_agent2 && \ - strip /usr/bin/zabbix_get && \ - strip /usr/bin/zabbix_sender && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - rm -rf /usr/local/go/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ + microdnf -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 diff --git a/build-base/ol/.dockerignore b/build-base/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/build-base/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/build-base/ol/Dockerfile b/build-base/ol/Dockerfile new file mode 100644 index 000000000..5fb511109 --- /dev/null +++ b/build-base/ol/Dockerfile @@ -0,0 +1,76 @@ +# syntax=docker/dockerfile:1 +FROM oraclelinux:8-slim + +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + PATH=/usr/local/go/bin:$PATH + +LABEL org.opencontainers.image.title="Zabbix build base" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base image contains all required packages to build Zabbix images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +RUN set -eux && \ + microdnf -y module enable mysql && \ + INSTALL_PKGS="autoconf \ + automake \ + bash \ + gcc \ + pcre-devel \ + libcurl-devel \ + libevent-devel \ + libssh-devel \ + libxml2-devel \ + openssl-devel \ + openldap-devel \ + make \ + mysql-devel \ + net-snmp-devel \ + OpenIPMI-devel \ + openldap-devel \ + sqlite-devel \ + postgresql-devel \ + java-1.8.0-openjdk-devel \ + git \ + wget \ + tar \ + gettext \ + unixODBC-devel" && \ + microdnf -y install \ + --disablerepo "*" \ + --enablerepo "ol8_baseos_latest" \ + --enablerepo "ol8_appstream" \ + --enablerepo "ol8_codeready_builder" \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ + ARCH_SUFFIX="$(arch)"; \ + case "$ARCH_SUFFIX" in \ + x86_64) \ + url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ + sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ + ;; \ + aarch64) \ + url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ + sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ + ;; \ + *) echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX-}"; exit 1 ;; \ + esac; \ + wget -O go.tgz.asc "$url.asc" && \ + wget -O go.tgz "$url" --progress=dot:giga && \ + echo "$sha256 *go.tgz" | sha256sum -c - && \ + GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796' && \ + gpg --batch --verify go.tgz.asc go.tgz && \ + gpgconf --kill all && \ + rm -rf "$GNUPGHOME" go.tgz.asc && \ + tar -C /usr/local -xzf go.tgz && \ + rm go.tgz diff --git a/build-base/ol/build.sh b/build-base/ol/build.sh new file mode 120000 index 000000000..fcb4d4ee7 --- /dev/null +++ b/build-base/ol/build.sh @@ -0,0 +1 @@ +../../build.sh \ No newline at end of file diff --git a/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo b/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo new file mode 100644 index 000000000..6c99308a6 --- /dev/null +++ b/build-base/ol/conf/etc/yum.repos.d/oracle-epel-ol8.repo @@ -0,0 +1,6 @@ +[ol8_developer_EPEL] +name=Oracle Linux $releasever EPEL Packages for Development ($basearch) +baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/developer/EPEL/$basearch/ +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle +gpgcheck=1 +enabled=0 diff --git a/build-mysql/ol/.dockerignore b/build-mysql/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/build-mysql/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/build-mysql/ol/Dockerfile b/build-mysql/ol/Dockerfile new file mode 100644 index 000000000..44d6cc9ec --- /dev/null +++ b/build-mysql/ol/Dockerfile @@ -0,0 +1,70 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${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 + +LABEL org.opencontainers.image.title="Zabbix build base (MySQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for MySQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +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 \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --enable-webservice \ + --with-mysql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --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 diff --git a/build-mysql/ol/build.sh b/build-mysql/ol/build.sh new file mode 120000 index 000000000..fcb4d4ee7 --- /dev/null +++ b/build-mysql/ol/build.sh @@ -0,0 +1 @@ +../../build.sh \ No newline at end of file diff --git a/build-pgsql/ol/.dockerignore b/build-pgsql/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/build-pgsql/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/build-pgsql/ol/Dockerfile b/build-pgsql/ol/Dockerfile new file mode 100644 index 000000000..79d9fe4dd --- /dev/null +++ b/build-pgsql/ol/Dockerfile @@ -0,0 +1,71 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${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 + +LABEL org.opencontainers.image.title="Zabbix build base (PostgreSQL)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for PostgreSQL based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +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 \ + --enable-agent \ + --enable-agent2 \ + --enable-server \ + --enable-proxy \ + --enable-webservice \ + --with-postgresql \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ +# --with-libmodbus \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + make -j"$(nproc)" -s gettext && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + cat database/postgresql/images.sql >> database/postgresql/create.sql && \ + cat database/postgresql/data.sql >> database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_server.sql.gz && \ + rm -rf database/postgresql/create.sql && \ + cat database/postgresql/schema.sql > database/postgresql/create.sql && \ + gzip -c database/postgresql/create.sql > database/postgresql/create_proxy.sql.gz && \ + rm -rf database/postgresql/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 diff --git a/build-pgsql/ol/build.sh b/build-pgsql/ol/build.sh new file mode 120000 index 000000000..fcb4d4ee7 --- /dev/null +++ b/build-pgsql/ol/build.sh @@ -0,0 +1 @@ +../../build.sh \ No newline at end of file diff --git a/build-sqlite3/alpine/Dockerfile b/build-sqlite3/alpine/Dockerfile index 7ce035b48..4fb1b0a9b 100644 --- a/build-sqlite3/alpine/Dockerfile +++ b/build-sqlite3/alpine/Dockerfile @@ -9,19 +9,19 @@ ARG MAJOR_VERSION ARG ZBX_VERSION ARG ZBX_SOURCES -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" \ - org.opencontainers.image.title="Zabbix build base (SQLite3)" \ +LABEL org.opencontainers.image.title="Zabbix build base (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" RUN set -eux && \ + cd /tmp/ && \ git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch /tmp/zabbix-${ZBX_VERSION} && \ - ls -lah /tmp/ && \ cd /tmp/zabbix-${ZBX_VERSION} && \ zabbix_revision=`git rev-parse --short HEAD` && \ sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \ diff --git a/build-sqlite3/ol/.dockerignore b/build-sqlite3/ol/.dockerignore new file mode 100644 index 000000000..88a84e55a --- /dev/null +++ b/build-sqlite3/ol/.dockerignore @@ -0,0 +1 @@ +build.sh diff --git a/build-sqlite3/ol/Dockerfile b/build-sqlite3/ol/Dockerfile new file mode 100644 index 000000000..78fac1f6b --- /dev/null +++ b/build-sqlite3/ol/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-base:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +LABEL org.opencontainers.image.title="Zabbix build base (SQLite3)" \ + org.opencontainers.image.authors="Alexey Pustovalov " \ + org.opencontainers.image.vendor="Zabbix LLC" \ + org.opencontainers.image.url="https://zabbix.com/" \ + org.opencontainers.image.description="Zabbix build base for SQLite3 based images" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" + +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 \ + --enable-agent \ + --enable-agent2 \ + --enable-proxy \ + --with-sqlite3 \ + --with-ldap \ + --with-libcurl \ + --with-libxml2 \ + --enable-java \ + --with-net-snmp \ + --with-openipmi \ + --with-openssl \ + --with-ssh \ + --with-unixodbc \ + --enable-ipv6 \ + --silent && \ + make -j"$(nproc)" -s dbschema && \ + make -j"$(nproc)" -s && \ + strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_agent/zabbix_agentd && \ + 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 \ No newline at end of file diff --git a/build-sqlite3/ol/build.sh b/build-sqlite3/ol/build.sh new file mode 120000 index 000000000..fcb4d4ee7 --- /dev/null +++ b/build-sqlite3/ol/build.sh @@ -0,0 +1 @@ +../../build.sh \ No newline at end of file diff --git a/docker-compose_v3_ol_mysql_local.yaml b/docker-compose_v3_ol_mysql_local.yaml index 17026a592..feaf85525 100644 --- a/docker-compose_v3_ol_mysql_local.yaml +++ b/docker-compose_v3_ol_mysql_local.yaml @@ -1,10 +1,41 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./build-base/ol + cache_from: + - oraclelinux:8-slim + image: zabbix-build-base:ol-local + + zabbix-build-mysql: + build: + context: ./build-mysql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-mysql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./build-sqlite3/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-sqlite3:ol-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./server-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-server-mysql:ol-local ports: - "10051:10051" @@ -44,6 +75,7 @@ services: # - root-ca.pem depends_on: - mysql-server + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -72,6 +104,8 @@ services: context: ./proxy-sqlite3/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local image: zabbix-proxy-sqlite3:ol-local profiles: - all @@ -105,6 +139,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -125,6 +160,8 @@ services: context: ./proxy-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-proxy-mysql:ol-local profiles: - all @@ -160,6 +197,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql secrets: - MYSQL_USER - MYSQL_PASSWORD @@ -187,6 +225,8 @@ services: context: ./web-apache-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-web-apache-mysql:ol-local profiles: - all @@ -218,6 +258,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -247,6 +288,8 @@ services: context: ./web-nginx-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-web-nginx-mysql:ol-local ports: - "80:8080" @@ -276,6 +319,7 @@ services: depends_on: - mysql-server - zabbix-server + - zabbix-build-mysql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -305,6 +349,8 @@ services: context: ./agent/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-agent:ol-local profiles: - full @@ -331,6 +377,8 @@ services: - .env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -349,6 +397,8 @@ services: context: ./java-gateway/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-java-gateway:ol-local profiles: - full @@ -365,6 +415,8 @@ services: memory: 256M env_file: - .env_java + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -415,6 +467,8 @@ services: context: ./web-service/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-web-service:ol-local profiles: - full @@ -435,6 +489,8 @@ services: memory: 256M env_file: - .env_web_service + depends_on: + - zabbix-build-mysql networks: zbx_net_backend: aliases: diff --git a/docker-compose_v3_ol_pgsql_local.yaml b/docker-compose_v3_ol_pgsql_local.yaml index 48849d541..d19ebb926 100644 --- a/docker-compose_v3_ol_pgsql_local.yaml +++ b/docker-compose_v3_ol_pgsql_local.yaml @@ -1,10 +1,52 @@ version: '3.5' services: + zabbix-build-base: + build: + context: ./build-base/ol + cache_from: + - oraclelinux:8-slim + image: zabbix-build-base:ol-local + + zabbix-build-pgsql: + build: + context: ./build-pgsql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-pgsql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-mysql: + build: + context: ./build-mysql/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-mysql:ol-local + depends_on: + - zabbix-build-base + + zabbix-build-sqlite3: + build: + context: ./build-sqlite3/ol + cache_from: + - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-base:ol-local + image: zabbix-build-sqlite3:ol-local + depends_on: + - zabbix-build-base + zabbix-server: build: context: ./server-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-server-pgsql:ol-local ports: - "10051:10051" @@ -43,6 +85,7 @@ services: - POSTGRES_PASSWORD depends_on: - postgres-server + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -71,6 +114,8 @@ services: context: ./proxy-sqlite3/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-sqlite3:ol-local image: zabbix-proxy-sqlite3:ol-local profiles: - all @@ -104,6 +149,7 @@ services: depends_on: - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-sqlite3 networks: zbx_net_backend: aliases: @@ -124,6 +170,8 @@ services: context: ./proxy-mysql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-mysql:ol-local image: zabbix-proxy-mysql:ol-local profiles: - all @@ -163,6 +211,7 @@ services: - mysql-server - zabbix-java-gateway - zabbix-snmptraps + - zabbix-build-mysql networks: zbx_net_backend: aliases: @@ -183,6 +232,8 @@ services: context: ./web-apache-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-web-apache-pgsql:ol-local profiles: - all @@ -214,6 +265,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -243,6 +295,8 @@ services: context: ./web-nginx-pgsql/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-web-nginx-pgsql:ol-local ports: - "80:8080" @@ -272,6 +326,7 @@ services: depends_on: - postgres-server - zabbix-server + - zabbix-build-pgsql healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/"] interval: 10s @@ -301,6 +356,8 @@ services: context: ./agent/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-agent:ol-local profiles: - full @@ -327,6 +384,8 @@ services: - .env_agent privileged: true pid: "host" + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -345,6 +404,8 @@ services: context: ./java-gateway/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-java-gateway:ol-local profiles: - full @@ -361,6 +422,8 @@ services: memory: 256M env_file: - .env_java + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: @@ -411,6 +474,8 @@ services: context: ./web-service/ol cache_from: - oraclelinux:8-slim + args: + BUILD_BASE_IMAGE: zabbix-build-pgsql:ol-local image: zabbix-web-service:ol-local profiles: - full @@ -431,6 +496,8 @@ services: memory: 256M env_file: - .env_web_service + depends_on: + - zabbix-build-pgsql networks: zbx_net_backend: aliases: diff --git a/java-gateway/ol/Dockerfile b/java-gateway/ol/Dockerfile index 3532f6090..c54511abb 100644 --- a/java-gateway/ol/Dockerfile +++ b/java-gateway/ol/Dockerfile @@ -1,14 +1,35 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix Java Gateway" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/bin", "/usr/sbin/zabbix_java/bin"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_java/lib", "/usr/sbin/zabbix_java/lib"] +COPY ["conf/etc/", "/etc/"] + RUN set -eux && \ groupadd --system --gid 1995 zabbix && \ useradd \ @@ -21,68 +42,20 @@ RUN set -eux && \ mkdir -p /etc/zabbix/ && \ mkdir -p /usr/sbin/zabbix_java/ && \ mkdir -p /usr/sbin/zabbix_java/ext_lib/ && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ INSTALL_PKGS="java-1.8.0-openjdk-headless \ findutils" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - java-1.8.0-openjdk-devel \ - make \ - git \ - gcc" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \ - ./bootstrap.sh && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-java \ - --silent && \ - make -j"$(nproc)" -s && \ - mkdir -p /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \ - cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -rf /usr/sbin/zabbix_java/lib/*.xml && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ chown --quiet -R zabbix:root /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chgrp -R 0 /etc/zabbix/ /usr/sbin/zabbix_java/ && \ chmod -R g=u /etc/zabbix/ /usr/sbin/zabbix_java/ && \ + microdnf -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 diff --git a/proxy-mysql/ol/Dockerfile b/proxy-mysql/ol/Dockerfile index 24b87bf25..820755f70 100644 --- a/proxy-mysql/ol/Dockerfile +++ b/proxy-mysql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_proxy.sql.gz", "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -33,9 +57,6 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-proxy-mysql && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ microdnf -y module enable mysql && \ INSTALL_PKGS="libevent \ tini \ @@ -53,88 +74,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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 && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/mysql/schema.sql > database/mysql/create.sql && \ - gzip database/mysql/create.sql && \ - cp database/mysql/create.sql.gz /usr/share/doc/zabbix-proxy-mysql/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -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 diff --git a/proxy-sqlite3/ol/Dockerfile b/proxy-sqlite3/ol/Dockerfile index 62c868375..55edd6baa 100644 --- a/proxy-sqlite3/ol/Dockerfile +++ b/proxy-sqlite3/ol/Dockerfile @@ -1,14 +1,36 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-sqlite3:ol-${ZBX_VERSION} + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix proxy (SQLite3)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy", "/usr/sbin/zabbix_proxy"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_proxy.conf", "/etc/zabbix/zabbix_proxy.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -34,9 +56,6 @@ RUN set -eux && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-proxy-sqlite3 && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ INSTALL_PKGS="libevent \ tini \ libssh \ @@ -51,88 +70,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - sqlite-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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 && \ - ./bootstrap.sh && \ - export CFLAGS="-fPIC -pie -Wl,-z,relro -Wl,-z,now" && \ - ./configure \ - --datadir=/usr/lib \ - --libdir=/usr/lib/zabbix \ - --sysconfdir=/etc/zabbix \ - --prefix=/usr \ - --enable-agent \ - --enable-proxy \ - --with-sqlite3 \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ - cp src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \ - cp src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \ - cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ - cat database/sqlite3/schema.sql > database/sqlite3/create.sql && \ - gzip database/sqlite3/create.sql && \ - cp database/sqlite3/create.sql.gz /usr/share/doc/zabbix-proxy-sqlite3/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -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 diff --git a/server-mysql/ol/Dockerfile b/server-mysql/ol/Dockerfile index 1d1c6a598..a1fa1bc65 100644 --- a/server-mysql/ol/Dockerfile +++ b/server-mysql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm \ + ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/mysql/create_server.sql.gz", "/usr/share/doc/zabbix-server-mysql/create.sql.gz"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -35,9 +59,6 @@ RUN set -eux && \ mkdir -p /usr/lib/zabbix/alertscripts && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-server-mysql && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ microdnf -y module enable mysql && \ INSTALL_PKGS="fping \ tini \ @@ -48,7 +69,6 @@ RUN set -eux && \ libevent \ libxml2 \ libssh \ - systemd \ mysql \ mysql-libs \ net-snmp-libs \ @@ -58,90 +78,18 @@ RUN set -eux && \ pcre \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - mysql-devel \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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 && \ - ./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 \ - --enable-agent \ - --enable-server \ - --with-mysql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - 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/ && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -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 diff --git a/server-pgsql/ol/Dockerfile b/server-pgsql/ol/Dockerfile index 05da6d5a9..14ccc79ad 100644 --- a/server-pgsql/ol/Dockerfile +++ b/server-pgsql/ol/Dockerfile @@ -1,14 +1,38 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ + MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL + LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_server/zabbix_server", "/usr/sbin/zabbix_server"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get", "/usr/bin/zabbix_get"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender", "/usr/bin/zabbix_sender"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/conf/zabbix_server.conf", "/etc/zabbix/zabbix_server.conf"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/create_server.sql.gz", "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/database/postgresql/timescaledb.sql", "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -35,9 +59,6 @@ RUN set -eux && \ mkdir -p /usr/lib/zabbix/alertscripts && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/share/doc/zabbix-server-postgresql && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ INSTALL_PKGS="fping \ file-libs \ tini \ @@ -56,94 +77,18 @@ RUN set -eux && \ postgresql-libs \ zlib \ unixODBC" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ microdnf -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 -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - pcre-devel \ - libcurl-devel \ - libevent-devel \ - libssh-devel \ - libxml2-devel \ - make \ - net-snmp-devel \ - OpenIPMI-devel \ - openldap-devel \ - postgresql-devel \ - git \ - unixODBC-devel" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch 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 && \ - ./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 \ - --enable-agent \ - --enable-server \ - --with-postgresql \ - --with-ldap \ - --with-libcurl \ - --with-libxml2 \ - --with-net-snmp \ - --with-openipmi \ - --with-openssl \ - --with-ssh \ - --with-unixodbc \ - --enable-ipv6 \ - --silent && \ - make -j"$(nproc)" -s dbschema && \ - make -j"$(nproc)" -s && \ - cp src/zabbix_server/zabbix_server /usr/sbin/zabbix_server && \ - 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/postgresql/schema.sql > database/postgresql/create.sql && \ - cat database/postgresql/images.sql >> database/postgresql/create.sql && \ - cat database/postgresql/data.sql >> database/postgresql/create.sql && \ - gzip database/postgresql/create.sql && \ - cp database/postgresql/create.sql.gz /usr/share/doc/zabbix-server-postgresql/ && \ - cp database/postgresql/timescaledb.sql /usr/share/doc/zabbix-server-postgresql/timescaledb.sql && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ - chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ - chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ - chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ - 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 - EXPOSE 10051/TCP WORKDIR /var/lib/zabbix diff --git a/web-apache-mysql/ol/Dockerfile b/web-apache-mysql/ol/Dockerfile index f1d3d1550..2759c9ac0 100644 --- a/web-apache-mysql/ol/Dockerfile +++ b/web-apache-mysql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -23,9 +42,6 @@ RUN set -eux && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ microdnf -y module enable mysql && \ microdnf -y module enable php:7.4 && \ INSTALL_PKGS="curl \ @@ -41,11 +57,17 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -54,39 +76,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ 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 && \ @@ -107,9 +97,10 @@ RUN set -eux && \ 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 && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -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 diff --git a/web-apache-pgsql/ol/Dockerfile b/web-apache-pgsql/ol/Dockerfile index 3d3df43ff..4bb6b4097 100644 --- a/web-apache-pgsql/ol/Dockerfile +++ b/web-apache-pgsql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim -LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, PostgreSQL)" \ +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + +LABEL org.opencontainers.image.title="Zabbix web-interface (Apache, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ - org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.description="Zabbix web-interface based on Apache2 web server with MySQL database support" \ + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -23,9 +42,6 @@ RUN set -eux && \ mkdir -p /etc/zabbix && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ microdnf -y module enable php:7.4 && \ INSTALL_PKGS="curl \ httpd \ @@ -40,11 +56,17 @@ RUN set -eux && \ php-json \ php-xml \ postgresql \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f "/etc/httpd/conf.d/default.conf" && \ rm -f "/etc/httpd/conf.d/ssl.conf" && \ rm -f /etc/php-fpm.d/www.conf && \ @@ -53,39 +75,7 @@ RUN set -eux && \ -e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \ "/etc/httpd/conf/httpd.conf" && \ sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ 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 && \ @@ -106,9 +96,10 @@ RUN set -eux && \ 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 && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -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 diff --git a/web-nginx-mysql/ol/Dockerfile b/web-nginx-mysql/ol/Dockerfile index 78941bb37..dc7d128fd 100644 --- a/web-nginx-mysql/ol/Dockerfile +++ b/web-nginx-mysql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, MySQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with MySQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -40,46 +59,20 @@ RUN set -eux && \ php-mysqlnd \ php-json \ php-xml \ + findutils \ + glibc-locale-source \ supervisor" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ 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 && \ @@ -100,9 +93,10 @@ RUN set -eux && \ 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 && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -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 diff --git a/web-nginx-pgsql/ol/Dockerfile b/web-nginx-pgsql/ol/Dockerfile index 4e4ea32b7..e9e2c236b 100644 --- a/web-nginx-pgsql/ol/Dockerfile +++ b/web-nginx-pgsql/ol/Dockerfile @@ -1,14 +1,33 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-pgsql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + +ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} + LABEL org.opencontainers.image.title="Zabbix web-interface (Nginx, PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web-interface based on Nginx web server with PostgreSQL database support" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/ui", "/usr/share/zabbix"] +COPY ["conf/etc/", "/etc/"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -24,9 +43,6 @@ RUN set -eux && \ mkdir -p /etc/zabbix/web && \ mkdir -p /etc/zabbix/web/certs && \ mkdir -p /var/lib/php/session && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ microdnf -y module enable php:7.4 && \ INSTALL_PKGS="supervisor \ curl \ @@ -39,46 +55,20 @@ RUN set -eux && \ php-mbstring \ php-pgsql \ php-json \ + findutils \ + glibc-locale-source \ php-xml" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ rm -f /etc/nginx/conf.d/*.conf && \ rm -f /etc/php-fpm.d/www.conf && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -COPY ["conf/etc/", "/etc/"] - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream,ol8_codeready_builder" && \ - INSTALL_PKGS="glibc-locale-source \ - gettext \ - findutils \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /usr/share/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - mkdir /usr/share/zabbix/ && \ - cp -R /usr/share/zabbix-${ZBX_VERSION}/ui/* /usr/share/zabbix/ && \ - rm -rf /usr/share/zabbix-${ZBX_VERSION}/ && \ cd /usr/share/zabbix/ && \ - ./locale/make_mo.sh && \ 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 && \ @@ -99,9 +89,10 @@ RUN set -eux && \ 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 && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -y remove \ + findutils \ + glibc-locale-source && \ + microdnf -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 diff --git a/web-service/ol/Dockerfile b/web-service/ol/Dockerfile index 3322b9649..d2d724940 100644 --- a/web-service/ol/Dockerfile +++ b/web-service/ol/Dockerfile @@ -1,14 +1,31 @@ +# syntax=docker/dockerfile:1 +ARG MAJOR_VERSION=6.0 +ARG ZBX_VERSION=${MAJOR_VERSION} +ARG BUILD_BASE_IMAGE=zabbix-build-mysql:ol-${ZBX_VERSION} +ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git + +FROM ${BUILD_BASE_IMAGE} as builder + FROM oraclelinux:8-slim +ARG MAJOR_VERSION +ARG ZBX_VERSION +ARG ZBX_SOURCES + LABEL org.opencontainers.image.title="Zabbix web service" \ org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.vendor="Zabbix LLC" \ org.opencontainers.image.url="https://zabbix.com/" \ org.opencontainers.image.description="Zabbix web servce for performing various tasks using headless web browser" \ - org.opencontainers.image.licenses="GPL v2.0" + org.opencontainers.image.licenses="GPL v2.0" \ + org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ + org.opencontainers.image.version="${ZBX_VERSION}" \ + org.opencontainers.image.source="${ZBX_SOURCES}" STOPSIGNAL SIGTERM +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_web_service", "/usr/sbin/zabbix_web_service"] +COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_web_service.conf", "/etc/zabbix/zabbix_web_service.conf"] COPY ["conf/etc/yum.repos.d/oracle-epel-ol8.repo", "/etc/yum.repos.d/oracle-epel-ol8.repo"] RUN set -eux && \ @@ -23,68 +40,21 @@ RUN set -eux && \ mkdir -p /etc/zabbix && \ mkdir -p /var/lib/zabbix && \ mkdir -p /var/lib/zabbix/enc && \ - mkdir -p /etc/yum/vars/ && \ - echo "" > /etc/yum/vars/ociregion && \ - echo "oracle.com" > /etc/yum/vars/ocidomain && \ INSTALL_PKGS="chromium \ openssl-libs \ zlib" && \ - microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \ + microdnf -y install \ + --disablerepo="*" \ + --enablerepo="ol8_baseos_latest" \ --enablerepo="ol8_appstream" \ --enablerepo="ol8_developer_EPEL" \ - install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \ - microdnf -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 - -ARG MAJOR_VERSION=6.0 -ARG ZBX_VERSION=${MAJOR_VERSION} -ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git - -ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} - -LABEL org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \ - org.opencontainers.image.version="${ZBX_VERSION}" \ - org.opencontainers.image.source="${ZBX_SOURCES}" - -RUN set -eux && \ - REPOLIST="ol8_baseos_latest,ol8_appstream" && \ - INSTALL_PKGS="autoconf \ - automake \ - gcc \ - make \ - golang \ - git" && \ - microdnf -y install --setopt=install_weak_deps=0 --best \ - --nodocs dnf && \ - dnf -y install --disablerepo "*" --enablerepo "${REPOLIST}" --setopt=install_weak_deps=False --best \ - --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - cd /tmp/ && \ - git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch master --depth 1 --single-branch zabbix-${ZBX_VERSION} && \ - cd /tmp/zabbix-${ZBX_VERSION} && \ - zabbix_revision=`git rev-parse --short HEAD` && \ - sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/go/pkg/version/version.go && \ - ./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 \ - --prefix=/usr \ - --enable-webservice \ - --silent && \ - make -j"$(nproc)" -s && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_web_service /usr/sbin/zabbix_web_service && \ - cp /tmp/zabbix-${ZBX_VERSION}/src/go/conf/zabbix_web_service.conf /etc/zabbix/zabbix_web_service.conf && \ - cd /tmp/ && \ - rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ + --setopt=install_weak_deps=0 \ + --best \ + --nodocs ${INSTALL_PKGS} && \ chown --quiet -R zabbix:root /etc/zabbix/ /var/lib/zabbix/ && \ chgrp -R 0 /etc/zabbix/ /var/lib/zabbix/ && \ chmod -R g=u /etc/zabbix/ /var/lib/zabbix/ && \ - dnf -y history undo last && \ - dnf -y clean all && \ - microdnf -y remove dnf && \ + microdnf -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