coreos-home-server/service/prometheus/Containerfile
Alex Palaistras f710c4846f Use safer curl invocations in Container builds
Calls to `curl` will now use the `--fail` option, in addition to
`--silent` and `--show-error`, in an effort to catch issues with server
or client-side errors.
2023-12-21 16:56:31 +00:00

41 lines
2.5 KiB
Docker

FROM docker.io/golang:1.21-bookworm@sha256:1415bb0b25d3bffc0a44dcf9851c20a9f8bbe558095221d931f2e4a4cc3596eb 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 # renovate: datasource=github-releases depName=containers/prometheus-podman-exporter extractVersion=^v(?<version>.*)$
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@sha256:f80c45482c8d147da87613cb6878a7238b8642bcc24fc11bad78c7bec726f340
ARG VERSION=2.48.1 # renovate: datasource=github-releases depName=prometheus/prometheus extractVersion=^v(?<version>.*)$
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 -fsSL 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 # renovate: datasource=github-releases depName=prometheus/node_exporter
RUN curl -fsSL 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"]