monitoring/example/images/prometheus/Dockerfile

49 lines
1.6 KiB
Docker

FROM danielberteaud/alpine:24.3-1 AS builder
ARG PROM_VERSION=2.51.1
ADD https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/prometheus-${PROM_VERSION}.linux-amd64.tar.gz /tmp
ADD https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/sha256sums.txt /tmp
RUN set -eux &&\
apk --no-cache add \
curl \
tar \
ca-certificates \
&&\
cd /tmp &&\
grep "prometheus-${PROM_VERSION}.linux-amd64.tar.gz" sha256sums.txt | sha256sum -c &&\
tar xvzf prometheus-${PROM_VERSION}.linux-amd64.tar.gz &&\
rm -f prometheus-${PROM_VERSION}.linux-amd64.tar.gz &&\
mv prometheus-${PROM_VERSION}.linux-amd64 /opt/prometheus
FROM danielberteaud/alpine:24.3-1
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
ENV PATH=/opt/prometheus:$PATH
COPY --from=builder /opt/prometheus /opt/prometheus
RUN set -eux &&\
addgroup -g 9090 prometheus &&\
adduser --system \
--disabled-password \
--uid 9090 \
--ingroup prometheus \
--home /opt/prometheus \
--no-create-home \
--shell /sbin/nologin \
prometheus &&\
mkdir /data &&\
chown prometheus.prometheus /data &&\
chmod 700 /data
WORKDIR /opt/prometheus
USER prometheus
EXPOSE 9090
CMD [ "/opt/prometheus/prometheus", \
"--config.file=/opt/prometheus/prometheus.yml", \
"--storage.tsdb.path=/data", \
"--storage.tsdb.wal-compression", \
"--storage.tsdb.wal-compression-type=zstd", \
"--web.console.libraries=/opt/prometheus/console_libraries", \
"--web.console.templates=/opt/prometheus/consoles" ]