2024-10-30 12:36:59 +01:00
|
|
|
ARG BUILD_FROM=ghcr.io/hassio-addons/base:16.2.1
|
2024-10-30 10:35:38 +01:00
|
|
|
# hadolint ignore=DL3006
|
|
|
|
FROM ${BUILD_FROM}
|
|
|
|
|
|
|
|
# Set shell
|
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
|
|
|
|
# Setup base system
|
|
|
|
ARG BUILD_ARCH=amd64
|
2024-10-30 12:36:59 +01:00
|
|
|
ENV PROMETHEUS_VERSION=2.54.1
|
2024-10-30 10:35:38 +01:00
|
|
|
|
|
|
|
# Copy root filesystem
|
|
|
|
COPY rootfs /
|
|
|
|
|
|
|
|
# hadolint ignore=DL3003
|
|
|
|
RUN \
|
|
|
|
ARCH="${BUILD_ARCH}" \
|
|
|
|
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
|
|
|
|
\
|
2024-10-30 12:36:59 +01:00
|
|
|
&& apk --no-cache add yq \
|
|
|
|
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
2024-10-30 10:35:38 +01:00
|
|
|
&& apk --no-cache add \
|
2024-10-30 12:36:59 +01:00
|
|
|
curl \
|
|
|
|
python3 \
|
|
|
|
py3-idna \
|
|
|
|
py3-certifi \
|
|
|
|
py3-chardet \
|
|
|
|
py3-yaml \
|
|
|
|
py3-urllib3 \
|
|
|
|
py3-requests \
|
2024-10-30 10:35:38 +01:00
|
|
|
&& apk --no-cache add --virtual .builddeps \
|
2024-10-30 12:36:59 +01:00
|
|
|
py-pip \
|
2024-10-30 10:35:38 +01:00
|
|
|
\
|
|
|
|
&& curl -J -L -o /tmp/prometheus.tar.gz \
|
|
|
|
"https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}.tar.gz" \
|
|
|
|
&& adduser -s /bin/false -D -H prometheus \
|
|
|
|
&& cd /tmp \
|
|
|
|
&& tar -xvf /tmp/prometheus.tar.gz \
|
|
|
|
&& mkdir -p /etc/prometheus \
|
|
|
|
&& cp prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/promtool /usr/local/bin/ \
|
|
|
|
&& cp prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/prometheus /usr/local/bin/ \
|
|
|
|
&& cp -R prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/console_libraries/ /etc/prometheus/ \
|
|
|
|
&& cp -R prometheus-${PROMETHEUS_VERSION}.linux-${ARCH}/consoles/ /etc/prometheus/ \
|
|
|
|
&& rm -r prometheus-${PROMETHEUS_VERSION}.linux-${ARCH} \
|
|
|
|
&& chown -R prometheus:prometheus /etc/prometheus \
|
|
|
|
&& pip3 install \
|
2024-10-30 12:36:59 +01:00
|
|
|
--break-system-packages \
|
2024-10-30 10:35:38 +01:00
|
|
|
--no-cache-dir \
|
|
|
|
--prefer-binary \
|
2024-10-30 12:36:59 +01:00
|
|
|
--find-links "https://wheels.home-assistant.io/alpine-3.15/${BUILD_ARCH}/" \
|
2024-10-30 10:35:38 +01:00
|
|
|
-r /opt/prometheus-configgen/requirements.txt \
|
|
|
|
\
|
|
|
|
&& apk --no-cache del .builddeps \
|
|
|
|
&& rm -f -r \
|
|
|
|
/tmp/*
|
|
|
|
|
|
|
|
# Build arguments
|
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG BUILD_REF
|
|
|
|
ARG BUILD_VERSION
|
|
|
|
|
|
|
|
# Labels
|
|
|
|
LABEL \
|
|
|
|
io.hass.name="Prometheus" \
|
|
|
|
io.hass.description="Cloud native metrics" \
|
|
|
|
io.hass.arch="${BUILD_ARCH}" \
|
|
|
|
io.hass.type="addon" \
|
|
|
|
io.hass.version=${BUILD_VERSION} \
|
2024-10-30 12:36:59 +01:00
|
|
|
maintainer="Martin George <marty@dingo.foo>" \
|
2024-10-30 10:35:38 +01:00
|
|
|
org.opencontainers.image.title="Prometheus" \
|
|
|
|
org.opencontainers.image.description="Cloud native metrics" \
|
2024-10-30 12:36:59 +01:00
|
|
|
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
|
|
|
|
org.opencontainers.image.authors="Martin George <marty@dingo.foo>" \
|
2024-10-30 10:35:38 +01:00
|
|
|
org.opencontainers.image.licenses="MIT" \
|
|
|
|
org.opencontainers.image.url="https://addons.community" \
|
2024-10-30 12:36:59 +01:00
|
|
|
org.opencontainers.image.source="https://github.com/martydingo/homeassistant-addon-prometheus" \
|
|
|
|
org.opencontainers.image.documentation="https://github.com/martydingo/homeassistant-addon-prometheus/blob/main/README.md" \
|
2024-10-30 10:35:38 +01:00
|
|
|
org.opencontainers.image.created=${BUILD_DATE} \
|
|
|
|
org.opencontainers.image.revision=${BUILD_REF} \
|
|
|
|
org.opencontainers.image.version=${BUILD_VERSION}
|