postgres/images/postgres-exporter/Dockerfile

23 lines
1.1 KiB
Docker

FROM [[ .docker.repo ]][[ .docker.base_images.alpine.image ]] AS builder
ARG EXPORTER_VERSION=[[ .pg.exporter.version ]]
ADD https://github.com/prometheus-community/postgres_exporter/releases/download/v${EXPORTER_VERSION}/postgres_exporter-${EXPORTER_VERSION}.linux-amd64.tar.gz /tmp
ADD https://github.com/prometheus-community/postgres_exporter/releases/download/v${EXPORTER_VERSION}/sha256sums.txt /tmp
RUN set -euxo pipefail &&\
apk --no-cache add tar gzip &&\
cd /tmp &&\
grep postgres_exporter-${EXPORTER_VERSION}.linux-amd64.tar.gz sha256sums.txt | sha256sum -c &&\
tar xvzf postgres_exporter-${EXPORTER_VERSION}.linux-amd64.tar.gz &&\
mv postgres_exporter-${EXPORTER_VERSION}.linux-amd64/postgres_exporter /usr/local/bin/postgres_exporter &&\
chown root:root /usr/local/bin/postgres_exporter &&\
chmod 755 /usr/local/bin/postgres_exporter
FROM [[ .docker.repo ]][[ .docker.base_images.alpine.image ]]
MAINTAINER [[ .docker.maintainer ]]
COPY --from=builder /usr/local/bin/postgres_exporter /usr/local/bin/postgres_exporter
CMD ["postgres_exporter"]