addon-prometheus/prometheus/Dockerfile
2020-07-26 19:22:27 +02:00

61 lines
2.5 KiB
Docker
Executable file

ARG BUILD_FROM=hassioaddons/base:8.0.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup base system
ARG BUILD_ARCH=amd64
ENV PROMETHEUS_VERSION=2.19.2
# Copy root filesystem
COPY rootfs /
RUN \
ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
\
&& apk update \
&& apk --no-cache add python3 py3-idna py3-certifi py3-chardet py3-yaml py3-urllib3 py3-requests \
&& apk --no-cache add --virtual builddeps py-pip \
\
&& 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 -r /opt/prometheus-configgen/requirements.txt \
&& apk del builddeps
# 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} \
maintainer="Robbert Müller <homeassistant@grols.ch>" \
org.opencontainers.image.title="Prometheus" \
org.opencontainers.image.description="Cloud native metrics" \
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
org.opencontainers.image.authors="Robbert Müller <homeassistant@grols.ch>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://addons.community" \
org.opencontainers.image.source="https://github.com/hassio-addons/addon-prometheus" \
org.opencontainers.image.documentation="https://github.com/hassio-addons/addon-prometheus/blob/master/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}