coreos-home-server/service/prometheus/Containerfile

41 lines
2.1 KiB
Plaintext
Raw Normal View History

FROM docker.io/golang:1.21-bookworm 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
ARG PODMAN_EXPORTER_VERSION=1.6.0
RUN git clone --branch v${PODMAN_EXPORTER_VERSION} --depth 1 https://github.com/containers/prometheus-podman-exporter.git /src && \
cd /src && make binary
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 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
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"]