ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:9.2.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG MAJOR_VERSION=7.4
ARG ZABBIX_VERSION=${MAJOR_VERSION}.11
ARG ZABBIX_DEB_URL="https://repo.zabbix.com/zabbix/${MAJOR_VERSION}/release/debian/pool/main/z/zabbix-release"
ARG ZABBIX_DEB_PKG="zabbix-release_latest_${MAJOR_VERSION}+debian12_all.deb"

RUN apt-get update && \
    apt-get install -y wget gnupg2 lsb-release && \
    wget ${ZABBIX_DEB_URL}/${ZABBIX_DEB_PKG} -O /tmp/zabbix-release.deb && \
    dpkg -i /tmp/zabbix-release.deb && \
    apt-get update && \
    apt-get install -y \
      zabbix-agent2=1:${ZABBIX_VERSION}* \
      smartmontools \
      sudo \
      iputils-ping && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/zabbix-release.deb

LABEL \
org.opencontainers.image.title="Zabbix Agent2 Add-on" \
org.opencontainers.image.description="Zabbix Agent2 for monitoring Home Assistant and related components" \
org.opencontainers.image.url="https://www.zabbix.com" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/current/manual/agent2"

COPY rootfs /
