coreos-home-server/service/prometheus/Containerfile

44 lines
2.4 KiB
Plaintext
Raw Normal View History

2023-12-20 23:11:27 +00:00
FROM docker.io/golang:1.21-bookworm@sha256:09ee26d3c9d6dd46913ba36e68b9041976010c2225f29759e6234909b17fe8bc AS podman-exporter-builder
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y --no-install-recommends libgpgme-dev libbtrfs-dev libdevmapper-dev libassuan-dev pkg-config
# renovate: datasource=github-releases depName=containers/prometheus-podman-exporter
ARG PODMAN_EXPORTER_VERSION=v1.6.0
RUN git clone --branch ${PODMAN_EXPORTER_VERSION} --depth 1 https://github.com/containers/prometheus-podman-exporter.git /src && \
cd /src && make binary
2023-12-20 23:11:27 +00:00
FROM docker.io/debian:bookworm-slim@sha256:f80c45482c8d147da87613cb6878a7238b8642bcc24fc11bad78c7bec726f340
# renovate: datasource=github-releases depName=prometheus/prometheus
ARG VERSION=2.48.0
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y --no-install-recommends curl ca-certificates libgpgme11 libbtrfs0 \
libdevmapper1.02.1 libassuan0
RUN addgroup --system --gid 10000 prometheus
RUN adduser --system --uid 10000 --ingroup prometheus --home /var/lib/prometheus prometheus
RUN curl --silent --show-error -L https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz | \
tar -C /opt --no-same-owner -xvzf - && \
mv /opt/prometheus-${VERSION}.linux-amd64 /opt/prometheus && \
mv /opt/prometheus/promtool /bin/promtool && \
mv /opt/prometheus/prometheus /bin/prometheus
# renovate: datasource=github-releases depName=prometheus/node_exporter
ARG NODE_EXPORTER_VERSION=1.7.0
RUN curl --silent --show-error -L https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz | \
tar -C /tmp --no-same-owner -xvzf - node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter && \
mv /tmp/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter /bin/node_exporter && \
rmdir /tmp/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64
COPY --from=podman-exporter-builder /src/bin/prometheus-podman-exporter /bin/podman_exporter
COPY container/config /etc/prometheus
USER prometheus
ENTRYPOINT ["/bin/prometheus", "--config.file=/etc/prometheus/prometheus.yml", \
"--storage.tsdb.path=/var/lib/prometheus", \
"--web.console.templates=/opt/prometheus/consoles", \
"--web.console.libraries=/opt/prometheus/console_libraries"]