coreos-home-server/service/prometheus/Containerfile
Alex Palaistras 08b39ff5e2 prometheus: Update version, add node exporter
This includes a complete overhaul of the Containerfile for moving to a
self-contained build based on Bookworm, a move to Quadlet, and the
inclusion of a node exporter for node metrics with a default Grafana
dashboard.
2023-11-19 12:46:42 +00:00

29 lines
1.5 KiB
Docker

FROM docker.io/debian:bookworm-slim
ARG VERSION=2.48.0
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y --no-install-recommends curl ca-certificates
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
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 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"]